Monday 15 September 2014

node.js - Does browser send ajax request again if no response for certain request? -



node.js - Does browser send ajax request again if no response for certain request? -

i making nodejs application , using jquery send ajax request server side.

weirdly, browser send ajax request multiple times.

is because of no response beingness returned server side?

$.ajax({ type: "post", url: "/triggerbatchjobs", data: json.stringify(buildinfo), contenttype: 'application/json' }).done(function(msg){ console.log(msg); });

i post ajax request code snippet, monitor network tab in chrome dev tools , found request stays in pending since there no response returned server side.

will browser seek send , response 1 time again these pending request?

btw, utilize socket.io in application. problem due socket.io?

script. var socket = io(); socket.on('complete',function(msg){ alert('complete'); })

in node.js

io.sockets.emit('complete');

weirdly, browser send ajax request multiple times.

no, in fact should something more complicated send request 1 time again if error occurred.

my suggestion set breakpoint in application $.ajax , check how many times stops. may utilize stack know phone call originates.

is because of no response beingness returned server side?

no @ all, if request expires, error callback called. (related, related) so, by default there no timeout established.

try

$.ajax( { ..., timeout:3000 ,... } );

will browser seek send , response 1 time again these pending request?

again, no.

i utilize socket.io in application. problem due socket.io?

i guess unrelated.

node.js browser

No comments:

Post a Comment