How to get jQuery/AJAX final URL
When I run $.get
or .load
in jQuery, the request seems to follow 302 redirects perfectly fine and gives me ultimate开发者_StackOverflow response, which I can use in the callback for $.get
or which plugs into the this
element for .load
.
While I obviously have the original URL since I am in control of the string that's entered as the first argument in $.get
or .load
(it would also be helpful if I could get this directly in the callback to simplify things), how can access the final (after redirect) URL in the callback?
I suspect that it would be in the XMLHttpRequest object, for which I have found the specification.
It appears you cannot. You can get the original src
, but then you cannot due to security issues.
精彩评论