我正在做的web基本上包含在一个文件中,有n个jquery .hide and .show()
调用。
所以现在我发布一个表单,并使用n个不同的php文件来处理提交。
处理完所有需要的内容后,我尝试使用header('Location: ' . $_SERVER['HTTP_REFERER']);
返回主页面。
但是".hide() and .show()
"的位置,我是在现在恢复到如果你只是第一次打开页面。
你能以某种方式调用一个jquery函数header
或发送一些消息从后处理脚本?
嘿,你为什么不使用jQuery POST到不同的页面,比如
$("#formname").submit(function() {
var url = "second.php"; // the script where you handle the form input.
$.ajax({
type: "POST",
url: url,
data: $("#formname").serialize(), // serializes the form's elements.
cache: false,
});
return false; // avoid to execute the actual submit of the form.
});
方法1:您可以使用get请求发送输出并通过全局$_GET['msg']
接收如。header('Location: ' . $_SERVER['HTTP_REFERER'] . '?msg=' . $somemsg );
方法二:在设置重定向之前,可以在会话中存储当前hide()
和show()
配置的一些信息。在重定向页面中,您可以检索配置