Access-Control-Allow-Origin in der Django-App, wenn mit Phonegap zugegriffen wird
Ich entwickle eine Phonegap-App für meine Django-basierte App. Beim Versuch, Ajax-Anrufe zu tätigen, wird jedoch der folgende Fehler angezeigt:
XMLHttpRequest cannot load http://domain.herokuapp.com/getcsrf/?tags=jquery%2Cjavascript&tagmode=any&format=json. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.
Wie kann ich es so machen, dass meine Django-App Cross-Origin für einige URLs zulässt?
Hier ist mein Ajax-Code:
get: function() {
$.getJSON("http://domain.herokuapp.com/getcsrf/",
{
tags: "jquery,javascript",
tagmode: "any",
format: "json"
},
function(data) {
$.each(data.items, function(item){
console.log(item);
});
});
}