jQuery Ajax GET doesn't work on Chrome
Hello,
I'm experimenting some problems with ajax calls on Chrome (In all other browser it works perfectly).
This is the jQuery code:
- $(document).ready(function() {
- $.ajaxSetup({ cache: true });
- call();
- });
- function call() {
- jQuery.ajax({url : webappUrl+'/en/map/statuses/'+community_id,
- type : 'get',
- dataType: 'json',
- async: true
- })
- .done(function(data){
- for(var i = 0; i < data.length; i++) {
- if(data[i].status ==1){
- inlay = {"id":data[i].geometry_id,"t":"#red"};
- mapDataObject.addInlay(inlay);
- inlayarray[data[i].geometry_id] = new Array();
- inlayarray[data[i].geometry_id]["aid"] = inlay.aid;
- inlayarray[data[i].geometry_id]["status"] = data[i].status;
- }
- if(data[i].status ==0){
- inlay = {"id":data[i].geometry_id,"t":"#green"};
- mapDataObject.addInlay(inlay);
- inlayarray[data[i].geometry_id] = new Array();
- inlayarray[data[i].geometry_id]["aid"] = inlay.aid;
- inlayarray[data[i].geometry_id]["status"] = data[i].status;
- }
- if(data[i].status ==4){
- inlay = {"id":data[i].geometry_id,"t":"#grey"};
- mapDataObject.addInlay(inlay);
- inlayarray[data[i].geometry_id] = new Array();
- inlayarray[data[i].geometry_id]["aid"] = inlay.aid;
- inlayarray[data[i].geometry_id]["status"] = data[i].status;
- }
- if(data[i].status ==5){
- inlay = {"id":data[i].geometry_id,"t":"#white"};
- mapDataObject.addInlay(inlay);
- inlayarray[data[i].geometry_id] = new Array();
- inlayarray[data[i].geometry_id]["aid"] = inlay.aid;
- inlayarray[data[i].geometry_id]["status"] = data[i].status;
- }
- };
- MapRefresh = setInterval('update()', 1000);
- })
- .fail(function(e){
- console.log(e);
- onMapChanged();
- });
- }
This is the error object I get in Chrome:
- abort: function (e){var t=e||w;return u&&u.abort(t),k(0,t),this}
- always: function (){return i.done(arguments).fail(arguments),this}
- complete: function (){if(l){var t=l.length;(function i(t){x.each(t,function(t,n){var r=x.type(n);"function"===r?e.unique&&p.has(n)||l.push(n):n&&n.length&&"string"!==r&&i(n)})})(arguments),n?o=l.length:r&&(s=t,c(r))}return this}
- done: function (){if(l){var t=l.length;(function i(t){x.each(t,function(t,n){var r=x.type(n);"function"===r?e.unique&&p.has(n)||l.push(n):n&&n.length&&"string"!==r&&i(n)})})(arguments),n?o=l.length:r&&(s=t,c(r))}return this}
- error: function (){if(l){var t=l.length;(function i(t){x.each(t,function(t,n){var r=x.type(n);"function"===r?e.unique&&p.has(n)||l.push(n):n&&n.length&&"string"!==r&&i(n)})})(arguments),n?o=l.length:r&&(s=t,c(r))}return this}
- fail: function (){if(l){var t=l.length;(function i(t){x.each(t,function(t,n){var r=x.type(n);"function"===r?e.unique&&p.has(n)||l.push(n):n&&n.length&&"string"!==r&&i(n)})})(arguments),n?o=l.length:r&&(s=t,c(r))}return this}
- getAllResponseHeaders: function (){return 2===b?a:null}
- getResponseHeader: function (e){var t;if(2===b){if(!c){c={};while(t=Tn.exec(a))c[t[1].toLowerCase()]=t[2]}t=c[e.toLowerCase()]}return null==t?null:t}
- arguments: null
- caller: null
- length: 1
- name: ""
- prototype: Object
- __proto__: function Empty() {}
- <function scope>
- overrideMimeType: function (e){return b||(p.mimeType=e),this}
- pipe: function (){var e=arguments;return x.Deferred(function(n){x.each(t,function(t,o){var a=o[0],s=x.isFunction(e[t])&&e[t];i[o[1]](function(){var e=s&&s.apply(this,arguments);e&&x.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[a+"With"](this===r?n.promise():this,s?[e]:arguments)})}),e=null}).promise()}
- progress: function (){if(l){var t=l.length;(function i(t){x.each(t,function(t,n){var r=x.type(n);"function"===r?e.unique&&p.has(n)||l.push(n):n&&n.length&&"string"!==r&&i(n)})})(arguments),n?o=l.length:r&&(s=t,c(r))}return this}
- promise: function (e){return null!=e?x.extend(e,r):r}
- readyState: 0
- responseText: ""
- setRequestHeader: function (e,t){var n=e.toLowerCase();return b||(e=v[n]=v[n]||e,y[e]=t),this}
- state: function (){return n}
- status: 0
- statusCode: function (e){var t;if(e)if(2>b)for(t in e)m[t]=[m[t],e[t]];else C.always(e[C.status]);return this}
- statusText: "error"
- success: function (){if(l){var t=l.length;(function i(t){x.each(t,function(t,n){var r=x.type(n);"function"===r?e.unique&&p.has(n)||l.push(n):n&&n.length&&"string"!==r&&i(n)})})(arguments),n?o=l.length:r&&(s=t,c(r))}return this}
- then: function (){var e=arguments;return x.Deferred(function(n){x.each(t,function(t,o){var a=o[0],s=x.isFunction(e[t])&&e[t];i[o[1]](function(){var e=s&&s.apply(this,arguments);e&&x.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[a+"With"](this===r?n.promise():this,s?[e]:arguments)})}),e=null}).promise()}
- __proto__: Object
In the Javascript Console at the Network Tab I can't see the ajax request.
It seems that Chrome trigger the error before the request is sent.
I can assure that the ajax request is not cross domain.
Please help me I'm getting mad with this! :(
Thank you!