php - return meta redirect in ajax response


I want to return a meta redirect tag in my Ajax response. How can this be done ?

I have a Zend Controller where in my init function I check for the session expiration. If the session already expired and the request was ajax I want to return a meta redirect tag to my log in controller.

If there is a better was please let me know.

public function init()
    if ($sessionExpired)
            $this->getResponse()->setBody('<meta http-equiv="refresh" content="1;url='.APP_URL.'/authentication/loginform'.'">');                        



Instead of redirecting with a meta tag, you could use thewindow.location property:


People are also looking for solutions to the problem: xss - What bad can do following php code?


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.