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: enter image description here

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

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -