How to handle redirection in an Ajax based application
Posted
by
nimo
on Stack Overflow
See other posts from Stack Overflow
or by nimo
Published on 2011-01-02T07:43:26Z
Indexed on
2011/01/02
7:53 UTC
Read the original article
Hit count: 294
hi all,
I'm developing a Ajax based php application. As anybody knows, I'm checking whether user is logged in every php file as the first statement. And there are two ways that I should response in an event of logging failure,
server redirect to the login page using header(url). CASE: If user directly enter a particular URL
passing url in Ajax response asking client side page redirection or notification CASE: If user trying to perform some action through a Ajax request
So my question is how can identify whether request coming from client side is a Ajax call or not ? If I know that I can handle my response accordingly.
OR Is there a better way of handling above scenario ?
Thank You
© Stack Overflow or respective owner