Skip to content
Advertisement

is not refreshing

I had a (very) simple login script which was working beautifully, and somehow, without much, if any, changes on the script page I have the following error:

The Problem

JavaScript

The above code is not refreshing, which means the user is not getting redirected after login. He/she has to manually refresh the page to start his/her session:

Enter image description here

As you can see from above image, the login was successful, but the page isn’t refreshing.

Please note using header("location:") is not an option here:

Also note I’m using Ajax with the form submission for what that is worth…

Part of the login script:

JavaScript

Strangely, this was working for me above, but it has since yesterday stopped working.

Solution

Is there a reason why this is not working?

Is there anything I can do to fix this?

Is there any alternative approach?

Advertisement

Answer

The way you are trying to do it will not work, because the <meta> tag is supposed to come in the <head> section of your page, not in the body. Plus, you can’t use <meta http-equiv="refresh"> or any other header directives once output is sent.

Try replacing this part:

JavaScript

with this:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement