njc njc - 1 year ago 73
Ajax Question

duplicate $.ajax request does not fire callback

If I make the exact same ajax request in the callback from the first request, the callback for the second request does not fire.

function doCall(){

The second call is made, and a 200 responds from the server but 'success2' is never printed.
The response for the request is JSON:


If I change the second request to


then it fires the callback.

Before anyone asks why I want to do this, what I have outlined here is a much simplified version of what I am actually doing that still demonstrates the problem. The application is on embedded hardware which sometimes responds with an error in which case the request needs to be retried.

Thanks in advance for any suggestions.

Answer Source

The fact that changing a parameter makes the call work leads me to believe it's a cache issue.

Use cache:false in the ajax parameters to prevent caching.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download