Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery.ajax() error with textStatus=error

The jQuery.ajax() function I use works correctly most of the time. However sometimes it is not returning any data. Instead the error() function is called.

$.ajax({

  [...]

  , error: function(jqXHR, textStatus, errorThrown) {
    console.log(jqXHR);
    console.log(textStatus);
    console.log(errorThrown);
  }
});

I can see in there that in those cases textStatus is 'error' and errorThrown is '' (empty).

The jQuery documentation just lists the possible values of textStatus ("timeout", "error", "abort", and "parsererror"). However it does not describe, what 'error' means.

jqXHR returns an object but it does not seam to reveal any additional insights.

How can I investigate what the source to this issue is?

like image 234
JochenJung Avatar asked Apr 29 '15 13:04

JochenJung


1 Answers

Found out it happens, whenever Reload is pressed in the browser, while the ajax request was still running.

This post helped me implement a solution.

like image 93
JochenJung Avatar answered Oct 31 '22 07:10

JochenJung