I have read a similar post to this, but I think my situation is a bit
different. I have a link like this:

<a href="/my-url.html" rel="the-div" class="modal-link">Link</a>

Then in my JS I use load something like this:

$('#modal-content').load('/my-url.html #the-div');

Which loads 'the-div' into a modal window on the page that called it.
It works perfectly. But if I decide that on '/my-url.html' requires
you to be logged in, and redirect you to login.html, nothing shows up
in my modal window. This is expected, since '/my-url.html #the-div'
does not exists. But I want to give the user a meaningful error
message. I can detect that '/my-url.html #the-div' isn't there, and
make a generic error, but I want to know if the page redirected. I
don't want to follow the redirect, just know that it happened, so I
can give proper feedback.

Right now, all I seem to have to work with is the resposeText of what
did come back. In there is a DOM element with an ID of "#login", but
that might not be the case some time in the future. What I really want
to know is the URI of the page that produced the reponseText. It is no
longer 'my-url.html', but instead 'login.html. But this does not
appear anywhere in the responseHeaders that I can see. Any thoughts?

Reply via email to