Redirect to a page/URL after alert button is pressed

后端 未结 6 1161
没有蜡笔的小新
没有蜡笔的小新 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:31

    You're missing semi-colons after your javascript lines. Also, window.location should have .href or .replace etc to redirect - See this post for more information.

    echo '';
    

    For clarity, try leaving PHP tags for this:

    ?>
    
    

    NOTE: semi colons on seperate lines are optional, but encouraged - however as in the comments below, PHP won't break lines in the first example here but will in the second, so semi-colons are required in the first example.

提交回复
热议问题