function register() {
hideshow('loading', 1);
//error(0);
$.ajax({
type: 'POST',
dataType: 'json',
url: 'submit.php',
data: $('#regForm').serialize(),
success: function (Cevap) {
if (Cevap.msg == "1") {
$('div.durumkayit').html('<div class="tamam">Sisteme Giriyoruz...</div>');
setTimeout("window.location = '../search/anamodul.php';", 1000);
} else {
$('div.durumkayit').html('<div class="hata">' + Cevap.msg + '</div>');
}
hideshow('loading', 0);
return false;
}
});
}
php代码$sonuc=array('msg'=>'Tüm alanların doldurulmasi zorunludur');
echo json_encode($sonuc);
我测试了你的代码。一切都好。唯一可能发生的事情如下:
- 呼叫
-
#regForm
不存在 - 隐藏未定义或有错误 你的ajax url是错误的
register()
时,但是,在ajax调用中添加一个错误处理程序将大有帮助:
$.ajax({
...
error: function(xhr, status, errorThrown){
alert("ERROR!!'n" + status);
}
});
似乎你有一个json parseerror
。但先测试一下。
检查文件编码。由于您有特殊字符(太特殊了!),最好在所有地方使用utf-8。
希望这对你有帮助。欢呼声