php - ajax request gets blocked until the server return the response -
i sending ajax request html page using jquery send bulk emails , fetch data server.
here code send request bulk mail
var sendreq = $.ajax({ type: 'post', data: "leftid="+json.stringify(leftid)+"&rightid="+json.stringify(rightid)+"&mode="+mode, datatype: 'json', url:"bulk.php" }); sendreq.done(function( data ) { $("#bms-ack").html(data.status); $("#bms-ack").fadein('slow'); $("#bms-ack").fadeout(6000); console.log(data); console.log("success"); }); sendreq.fail(function(jqxhr, data){ $("#bms-ack").html(data.status); $("#bms-ack").fadein('slow'); $("#bms-ack").fadeout(6000); console.log("fail"); }); now issue when send request php page send mails , respond success message.
as php returning response client ajax request going blocked ? because when send request jqtable fetch new data takes time until previous request of ajax send bulk mail hans't finished. , jqtable keeps loading.
how rid of blocking request , should remove returning success message php , if how user know request has been submitted ?
if understand correctly issue can't fire javascript call while first 1 running? that's because javascript single-threaded in browser implementations.
some light reading:is javascript guaranteed single-threaded?
Comments
Post a Comment