mardi 29 août 2017

Redirecting in PHP and JS without refreshing the page

I am trying to make a web fileserver (a cloud). I decided to put a basic form password auth on index.php. When user enters the password and clicks the button, JS sends that password to index.php and it decides if it correct.

If it is, then index.php redirects the user to files.php. If not, then refreshes the page. I know that redirecting and refreshing is done through header();, but when I use this and watch the "Network" tab in my browser, it receives the files.php but doesn't load it (stays on index.php). I am sure the reason is header sent after some text (well, it is header).

How do I redirect user's browser to some page after current page been sent? Should I ask JS to do it? Then how?




Aucun commentaire:

Enregistrer un commentaire