Javascript PHP重定向显示在<;部门>;而不是重定向到特定页面

Javascript PHP重定向显示在<;部门>;而不是重定向到特定页面,javascript,php,jquery,html,ajax,Javascript,Php,Jquery,Html,Ajax,我是PHP新手。 我正在尝试提交一个表单供服务器处理。如果满足某个条件,用户将被重定向到另一个页面。否则,将在用户单击提交的同一页面上显示一条消息 使用ajax可以成功地显示消息,但是重定向(服务器端的头重定向)不起作用,而是整个页面显示在客户端页面的div中 客户端: $(document).ready(function() { // bind form using ajaxForm $('#NextForm').ajaxForm({ // target identifies t

我是PHP新手。 我正在尝试提交一个表单供服务器处理。如果满足某个条件,用户将被重定向到另一个页面。否则,将在用户单击提交的同一页面上显示一条消息

使用ajax可以成功地显示消息,但是重定向(服务器端的头重定向)不起作用,而是整个页面显示在客户端页面的div中

客户端:

$(document).ready(function() { 
// bind form using ajaxForm 
$('#NextForm').ajaxForm({ 
    // target identifies the element(s) to update with the server response 
    target: '#NextDiv', 

    // success identifies the function to invoke when the server response 
    // has been received; here we apply a fade-in effect to the new content 
    success: function() { 
        $('#NextDiv').fadeIn('slow'); 
    } 
}); 
使用


您可以使用json_encode()从服务器发送消息。在服务器的php文件中添加以下代码

$msg = "This is message";
$myarray = array( "msg" => $msg);
echo json_encode($myarray);
从jquery脚本中,您可以得到如下内容:

$.ajax ({
type: 'GET',
url: 'phpfile.php',
dataType: 'json',
success: function (data) {
$("#NextDiv").text(data['msg']);
$('#NextDiv').fadeIn('slow');<br> }
});
$.ajax({
键入:“GET”,
url:'phpfile.php',
数据类型:“json”,
成功:功能(数据){
$(“#NextDiv”).text(数据['msg']);
$('NextDiv').fadeIn('slow');
} });
注意:'phpfile.php'是服务器中要向您发送消息的文件名


希望对你有帮助。

我是瞎子吗?或者有我看不到的ajax请求?您的php代码在哪里?
$.ajax ({
type: 'GET',
url: 'phpfile.php',
dataType: 'json',
success: function (data) {
$("#NextDiv").text(data['msg']);
$('#NextDiv').fadeIn('slow');<br> }
});