<div class="grid--cell fl1 lh-lg">
<div class="grid--cell fl1 lh-lg">
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, <a href="/help/reopen-questions">visit the help center</a> for guidance.
</div>
</div>
</div>
<div class="grid--cell mb0 mt8">Closed <span title="2012-03-15 09:18:40Z" class="relativetime">8 years ago</span>.</div>
</div>
</aside>
I have a very special problem with jQuery ajax requests.
when a user is browsig various parts of the webpage, there are jquery get() calls to fetch some content. The thing is that those requests stop working on random occasions. When I check the request response in firebug, the request status is 200 OK, but the firebug request is colored as red as in there was an error, but there is no error message.
The response tab in firebug is empty.
The thing is that is I visit those urls normally, not thought ajax, the content is returned normally.
So if I restart the browser it's all good again, I'm using jquery 1.7.1 and jquery.effects.core.js
Here's where I make the request:
$.get('abc', function(data) {
...
}).error(function(xhr, status, error) { alert("An AJAX error occured: " + status + "
Error: " + error);});
The alert gets called when the problem occurs and the 'status' variable has value of 'error' and the 'error' variable is an empty string...
I really have no idea what could the problem. Some help would be appreciated
</div>
Remember to always catch errors and report them so you can find the problem without guessing what it may be:
$.ajax({
url : '<url>',
success : function (serverResponse) { ... },
error : function (jqXHR, textStatus, errorThrown) {
if (typeof console == 'object' && typeof console.log == 'function') {
console.log(jqXHR);
console.log(textStatus);
console.log(errorThrown);
}
}
});
This checks to make sure that console.log
exists and is a function before trying to use it. If console.log
exists then this will log the all the error information associated with the AJAX request.