我已经提交表单使用php,ajax和jquery.I要防止表单提交根据ajax条件。但不stoppng提交表单。任何机构给任何解决方案对于这些问题? 下面使用ajax和jquery防止表单提交根据条件ajax
<script>
function validate_form()
{
var sale_type= $('#sale_type').val();
var cust_name= $('#cust_name').val();
if(sale_type=='credit')
{
alert("msg");
$.ajax({
type: "POST",
url: 'ajx_validation_due_date.php',
data:'cust_name='+cust_name,
success: function(msg)
{
alert(msg);
if(msg==0)
{
alert("You cant add sale,Due days is completed");
preventDefault();
return false;
}
}
});
}
}
</script>
<form action="" method="post" name="adFrm" onSubmit="return validate_form()">
</form>
什么是'cust_name'? 'msg'的价值是什么? – 2014-10-08 05:42:18
我有cust_name值,我忘了添加它,味精值是0 – 2014-10-08 05:47:35