Perform an ajax call from AngularJS to a Django server that allows CORS -
i developing webapp using angularjs , rest api based on django-tastypie data.
to able perform ajax requests, enabled cross origin resource sharing on django using django-cors-header framework (https://github.com/ottoyiu/django-cors-headers), noticed in chrome inspector preflighted request (an options request) sent before main request cancelled , saw in django server logs : "options /api/airport/19643 http/1.1" 301
i found posts suggesting delete 'x-requested-with'
parameter header ($http.get not allowed access-control-allow-origin $.ajax is) resolves problem requests. if try send put or post request, preflighted request sent , gets cancelled !
here see on inspector when enable cors don't delete previous parameter header:
i same error put requests well.
i can't see problem is, hope if point me right direction.
thanks lot
i suggest,can try below command line options chrome allowing cors in local testing :
chrome.exe --allow-file-access-from-files
note : chrome must not open. when run command chrome open automatically.
if entering command in command prompt select chrome installation directory use command.
Comments
Post a Comment