0

只是想知道是否有一种方法可以在 PHP else die 语句的事件中包含一个 JQuery 模式框/弹出窗口,例如:else die("Invalid");.

因此,else die 不会触发页面上显示的输出,而是Invalid触发包含 output 的 JQuery 模式弹出框Invalid

4

2 回答 2

0

您可以通过简单地跟踪 php 的成功输出来完成

<?php
if($logged) {
 echo "success";
} else {
 die("Sorry incorrect login information");
}
?>

你可以用jquery跟踪它

$(#form).on("submit",function() {
var inputs = $(this).serialize();
var ulr = $(this).attr("action");
$.post(url, inputs, function(data) {
 if(data !="success") {
//display UI dialog or alert with data

} else {
//proceed
}
});
});
于 2012-11-27T05:37:37.677 回答
0

First better use exit() not die :) it's the standard.

You can write

else { exit("<script>alert('s');</script>"); }

Inside it you can write in your script. It will run! But if you want jquery you must be sure that it has been loaded before this exit line. After it nothing more will be send to user browser.

于 2012-11-27T05:34:28.117 回答