Reputation: 14048
I'm trying to test a jQuery/Javascript script on my local development environment. For some reason the script calls the error delegate. I've attempted to make sure I'm not performing a cross-domain request.
$.ajax({
url: 'http://localhost',
success: function(data, textStatus, jqXHR) {
console.log('success');
console.log(data);
},
error: function(jqXHR, textStatus, errorThrown) {
console.log(textStatus);
console.log(errorThrown);
console.log(jqXHR);
}
});
return marker;
}
I'm running a WAMP stack. Here is my output:
error
undefined
XMLHttpRequest { mozResponseArrayBuffer=ArrayBuffer, status=0, more...}
Does anyone know what could be the issue?
Upvotes: 0
Views: 1027
Reputation: 1039248
Try replacing the absolute url:
url: 'http://localhost'
with a relative one:
url: '/'
If this doesn't solve your problem FireBug and/or Fiddler will give you more hints about what is going on and why the AJAX request fails.
Upvotes: 2