i have the same exact issue here [1]: Dealing with clients behind slow connection
the ajax call works fine when fast internet users use my portal, how ever it give empty response with 200 ok for success call back for users with slow internet connection
its not time out issue that i can handle in error call back, its a wired issue as the success callback is triggered with 200 ok and empty response
Don't know why this happen only for users with slow internet connection.
any ideas ?
You could add a loading mask to the div, using before send function in Ajax, until the data is fetched successfully.... something like;
jQuery.ajax({
url: "yourscript.php",
type: "POST",
dataType: 'json',
beforeSend: function() {
jQuery(".selector #overlay").show();
},
success: function(response) {
if (response > 0) {
jQuery(".selector #overlay").fadeOut(800);
// your code......
`
and in your CSS add a spinner or similar to the #overlay element;
#overlay{display: none; position:absolute; top: 0; right: 0; bottom: 0; left: 0;width: 100%;height: 100%; background: rgba(207, 207, 207, 0.5) url(/assets/spinner.gif) center center no-repeat;}