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) {
console.log("DEBUG jqXHR.responseText : ",jqXHR.responseText);
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 on IE8/9, as it requires XDR object, its did not work and showing console as
LOG: DEBUG jqXHR.responseText : undefined
LOG: Failure!
LOG: DEBUG: Something went wrong
Any help or hack?
My Request Header:
Accept:application/json, text/javascript, */*; q=0.01
Accept-Encoding:gzip, deflate, sdch
Accept-Language:en-US,en;q=0.8
Cache-Control:max-age=0
Connection:keep-alive
Host:localhost:8080
Origin:http://localhost:9000
Referer:http://localhost:9000/
User-Agent:Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.101 Safari/537.36
Response headers in non IE 8/9 browsers
Access-Control-Allow-Origin:*
Content-Type:application/json
Date:Wed, 25 Mar 2015 16:01:56 GMT
Server:Apache-Coyote/1.1
Transfer-Encoding:chunked