I would like to get the url from a jQuery success function, after it retreives data from the server. Unfortunately, the three parameters the success function takes don’t expose the original url:
success: function(data, statusText, jqhxr)
I dumped the jqhxr variable, and couldn’t find the url in there. The reason I need the url is because I’m making several calls at once through a loop, and therefore I have no idea which Ajax call is coming back. Making it an asynchronous call didn’t help either.
Thank you in advance!
this.urlinside success function will work becausethisrefers to the current context of the function, and since the success function is part of the settings object that you’re passing to.ajax()it will access the url property.See an article describing js scope and .ajax().