使用ajax表单插件。这是插件的链接http://www.malsup.com/jquery/form/#api ..
jQuery('#update-personal-information-form').ajaxForm( {
beforeSubmit: function() {
jQuery('#update-personal-information-form').validate({
errorClass: "error",
errorElement: "div",
rules:{
first_name:{required:true},
last_name:{required:true},
email:{required: true, email:true},
dob:{required: true,dateISO: true}
},
messages:{
first_name:{required:" First Name:cannot be blank"},
last_name:{required:" Last Name:cannot be blank"},
email:{required:" Email:cannot be blank"},
dob:{required:" Date Of Birth:cannot be blank",dateISO: "Invalid date. Must be formatted yyyy-mm-dd"}
}
});
return jQuery('#update-personal-information-form').valid();
},
success: function() {
var url1 = './index.php?r=user/personal_information';
jQuery("#dialog_edit_personalinfo").remove();
jQuery("#body1").load(url1);
}
});
这在所有的浏览器中都很好用,但是在10中它以表单提交和页面刷新的方式工作。我在过去的四个小时内搜索,但没有找到结果,请帮助我。谢谢..