javascript - php header does not work with ajax. Issue with reloading with js -
Then I'm using an AGI request to post
in the php script. At some point, PHP script redirects.
It should be at least well, but it does all kinds of weird stuff
header ('location: index.php');
It receives all the contents in index.php and puts it in the callback area.
So I decided to reload the page using javascript. And this is what I got
$ Post ('booking.php', {firstname: $ ('# firstname'). Val () .trum (), last name: $ ('#lastname') .val (). Trim ()}, function (data ) {Window.location = 'index.php'; $ ('Notification-Booking'). Html (Data);});
The problem is giving some feedback. I reload the page when the feedback is displayed for a moment. Which burden can be burdened if the user has not finished reading the lesson so I would like to do the following.
- Reload the page,
- Display the response
- Eat donuts and be happy.
I do not have the exact order at that number 3 under the control, help on number 1
You can pass variables on the second page through Javascript, then retrieve them via PHP in such a way that as long as the user needs to read it, the information Can display.
Javascript on first page
window.location = 'Second.php? FirstVar = '+ firstname +' & amp; SecondVar = '+ Last name +';
Then inside second.php, you can retrieve the value of those variables, and you can please display them.
& lt ;? Php $ first = $ _GET ['firstVar']; $ End = $ _GET ['seconds']; ? & Gt;
I recommend that you redirect the user to JavaScript rather than PHP headers because it is easy to screw the PHP header. I agree that this is the reason that you are behaving strangely.
Comments
Post a Comment