Redirect to a page/URL after alert button is pressed

后端 未结 6 1172
没有蜡笔的小新
没有蜡笔的小新 2020-12-16 01:00

i have referred to this two questions call php page under Javascript function and Go to URL after OK button in alert is pressed. i want to redirect to my index.php after an

6条回答
  •  情深已故
    2020-12-16 01:22

    window.location = mypage.href is a direct command for the browser to dump it's contents and start loading up some more. So for better clarification, here's what's happening in your PHP script:

    echo '';
    

    1) prepare to accept a modification or addition to the current Javascript cache. 2) show the alert 3) dump everything in browser memory and get ready for some more (albeit an older method of loading a new URL (AND NOTICE that there are no "\n" (new line) indicators between the lines and is therefore causing some havoc in the JS decoder.

    Let me suggest that you do this another way..

    echo '\n';
    

    1) prepare to accept a modification or addition to the current Javascript cache. 2) show the alert 3) dump everything in browser memory and get ready for some more (in a better fashion than before) And WOW - it all works because the JS decoder can see that each command is anow a new line.

    Best of luck!

提交回复
热议问题