neolaser
neolaser

Reputation: 6907

jQuery re-send ajax call after success

I want to be able to re-send an AJAX request (using jQuery) after is has been completed. This was my initial implementation

$.ajaxSetup({  
  complete: function(xhr, status) {
    $.ajax(xhr)
  }
});

But it seems as though I haven't understood the documentation as this doesn't fire off a request to the same URL.

Is there a way to complete this?

(p.s. I understand that if the above example was to work, that it would be an infinite loop of the same ajax request, this has been reduced for example purposes only :) )

Upvotes: 3

Views: 2124

Answers (1)

Kevin B
Kevin B

Reputation: 95022

Just do

$.ajax({
    url: "foo.cfc",
    success: function(){
        $.ajax(this);
    }
})

this is the settings passed in.

The same works for completed, but your question title asks for success.

Upvotes: 7

Related Questions