22

I have a web application that crashes on ajax requests with google chrome (it works with every other web browser it was tested it). After debugging I found that the error is caused by response.responseText being undefined. The xhr object looks like this:

argument: undefined isAbort: false isTimeout: undefined status: 0 statusText: "communication failure" tId: 3 

In debugger in the 'network' tab I get "(failed)", however all the headers are there and I can even copy into clipboard the response body (which is a valid JSON).

My question is - how can I debug this problem? Where to find additional information, what causes this request to fail?

4
  • Please, provide more info on the server and network infrastructure. Does the error occur every time you issue the request or sporadically? Commented Dec 17, 2012 at 19:05
  • Can you show how you are doing the AJAX call? Also, can you please tell in which browsers it is working? Commented Feb 12, 2013 at 7:02
  • Are you not receiving any errors within the JavaScript console? Commented Feb 17, 2013 at 1:44
  • What say this error? Can you paste error message here? Commented Feb 17, 2013 at 12:03

2 Answers 2

13

I finally found the solution to my problem : AdBlocks, when it blocks an ajax request, it just says "communication failure".

Sign up to request clarification or add additional context in comments.

2 Comments

THANK YOU for pointing this out. Spent the better of the afternoon banging my head over this.
thanks , you saved my day ! adBlocks prevents ajax requests such as ads/add ... excluding domain from adBlocks solved my problem !
4
+50

The first thing I would double-check is that the data coming back from the response is valid JSON. Just pass it through a JSON validator like this online JSONLint: http://jsonlint.com/

I assume that you are using something like jQuery to make your AJAX requests. If so, then make sure that you are using the development version of that library. Now that you are using the development version (uncompressed) of the script, find the particular function that you are using (eg. $.ajax) and then, within the Chrome inspector, insert a breakpoint in the code where the AJAX response is first handled (eg. https://github.com/jquery/jquery/blob/master/src/ajax.js#L579). Then proceed to step through the code, inspecting various return-values to see exactly what is going wrong.

If you are not using something like jQuery to make AJAX calls, then I'd recommend using a framework to avoid possible cross-browser compatibility issues like you might be experiencing right now.

1 Comment

I'm not sure if this is the correct fix, as it was long time ago, but I didn't think the invalid json could be a reason to display the request as failed. So I accept your anwer hoping that if I encounter this in the future, it would be helpful.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.