mercredi 25 mars 2015

Ember supporting XDomainRequest(xdr) for CORS

I am using ember 1.5 using grunt-cli and wanted to happen ajax call for CORS support using dataType: "JSON".



Ember.$.ajax({
type: "GET",
url: App.serverURL + 'logVisit', // callback for jsonP
data : {
'fp': App.fp
},
dataType : "JSON",
success: function(response) {
console.log('DEBUG: visitor has been registered');
},
error: function(jqXHR, textStatus, errorThrown) {
var response = jqXHR.responseText;

console.log('Failure!');
if(jqXHR.status&&jqXHR.status==400){
// alert(jqXHR.responseText);
var response = $.parseJSON(jqXHR.responseText);

if (response) {
console.log(response.error);
} else {
// This would mean an invalid response from the server - maybe the site went down or whatever...
console.log("DEBUG: Inside jqXHR.status : Something went wrong");
}
} else {
console.log("DEBUG: Something went wrong");
}
}
});


on IE10/11 its running good but because of XDR, its not working properly and showing console as



LOG: Failure!
LOG: DEBUG: Something went wrong


Any help or hack?





Aucun commentaire:

Enregistrer un commentaire