aisensiy
aisensiy

Reputation: 1520

Store ajax request for further use in jQuery

Here is my scenario.

  1. I send a request before login and the server tell me to login.
  2. And I hope to send the request before login automatically after I login.

So how can I store the request and trigger it again after login?

Upvotes: 0

Views: 79

Answers (1)

o01
o01

Reputation: 5440

Perhaps something like this?

var request = {
    url : 'somehandler.php',
    data : parameters,
    success: function(){
        // handler for success
    },
    error : function(){
        // handler for error
    }
};

Then you store the request options in the variable request, which you can reuse later like so:

$.ajax(request);

Upvotes: 2

Related Questions