Identify network problems during ajax request with JQuery -


i have question jquery.ajax request. in nutshell have ajax call following one:

   $.ajax({        url: <my_url>,        type: "post",        data: <my_data>,        datatype: "json",        responsetype: "json",        contenttype: 'application/json; charset=utf-8',        success: doonsuccess,        error: doonerror,    }); 

so far good. works in every case when there no connection, in such case sniffer said request has failed nothing called notify me , web page remains in loading mode indefinitely.

so recap, need tell users request won't fulfilled due missing connection. please me stuff. having way achieve connection status before send request fit ok of course. ( saw there no cross-browser solution anyway , cannot implement keep-alive mechanismm setting timeout in ajax request).

thanks in advance

regards

maybe try adding timeout $.ajax call, can prompt error message @ error callback.

please check http://api.jquery.com/jquery.ajax/ .


Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -