Take the 2-minute tour ×

I have this function that constantly uploads browser data to server by jquery post. Interval is as soon as every second. It seems that some requests don't make it to the server.

The question is how do I make sure every ajax requests are successful. Re-post until it's successful? One thing to consider is data has a high chance of being overwritten by upcoming upload() instances when one instance is known failed. So need to preserve the original data in failed instance too.

function upload(){          
share|improve this question
What i'd be asking is, why is it failing? Have you put in an error callback? –  user24359 Nov 22 '11 at 1:35
You could use Ajax Queue Manager –  Sudhir Nov 22 '11 at 1:37
1 second? Your poor server! –  epascarello Nov 22 '11 at 1:37
You'll have to show all the relevant code that is involved in repeatedly calling this function and acting on it's results. Only then could we advise on the proper way to handle this. –  jfriend00 Nov 22 '11 at 1:43
@Sudhir Maybe a comment isn't the place for this, but I'd be curious to know if you're aware of and can recommend any such queue managers that are mature and have a good (or at least well-documented) API. –  Greg Pettit Nov 22 '11 at 1:46
show 1 more comment

1 Answer

$post has success, error and complete methods like that;

$.post("example.php", function() {

taken from JQuery documentation here so you can re-post in error part

share|improve this answer
add comment

Your Answer


