开发者

how to use alert in php and js combined

开发者 https://www.devze.com 2023-01-03 22:47 出处:网络
have a need to alert thr开发者_运维知识库ough php, I have the code below. Problem is that it works as long as I dont use header redirect. Butas soon as I use it..I loose alert.

have a need to alert thr开发者_运维知识库ough php,

I have the code below. Problem is that it works as long as I dont use header redirect. But as soon as I use it..I loose alert.

echo "I will do some functions here in php";  
if($value == 1){  
alert('ok working');  
}  
header(location: 'someOtherpagethanthis.php');  


A redirect instructs the browser to immediately fire a brand new request. The response body with the alert will be ignored. You may want to use JS instead to fire a new request after the alert.

if ($value == 1) {  
    alert('ok working');  
    window.location = 'someOtherpagethanthis.php';
}  
0

精彩评论

暂无评论...
验证码 换一张
取 消