1

In my project I have several ajax global events.

In

$(document).ajaxSend(function(event, jqxhr, settings) {
   // 
});

I can get requested url from settings.url

But how can I get url from response from this request in

$(document).ajaxComplete(function (e, jqxhr) {
    //
});

The only object that contains requested url here is arguments[2].url

Is there other way to obtain requested url from response, because I'm not sure in such object as arguments[2].url?

1
  • because I'm not sure in such object as arguments[2].url ...why not? Commented Jan 26, 2015 at 14:08

2 Answers 2

5

arguments[2] is exactly the same as settings

$(document).ajaxComplete(function (e, jqxhr, settings) {
    // arguments[2] === settings
});
Sign up to request clarification or add additional context in comments.

Comments

1

in your complete of ajax try using like this:

$( document ).ajaxComplete(function( event, xhr, settings ) {
  alert(settings.url);
});

see documentation here

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.