Ajax代码不起作用,只有验证起作用

Ajax代码不起作用,只有验证起作用,ajax,Ajax,我的Ajax代码不起作用,我不知道如何。。 我曾多次在下面的代码中使用ajax,但这次不起作用 请帮帮我 只有此代码在ajax代码中运行 if(!validateee()) return false; $('#body-enquiry').submit(function(e){ e.preventDefault(); if(!validateee()) return false; $(this).find(

我的Ajax代码不起作用,我不知道如何。。 我曾多次在下面的代码中使用ajax,但这次不起作用 请帮帮我

只有此代码在ajax代码中运行

if(!validateee()) return false; 
$('#body-enquiry').submit(function(e){  
              e.preventDefault(); 
            if(!validateee()) return false; 
             $(this).find(":submit").prop("disabled", true); 

            var form = $(this);  
            var post_url = 'enquiry-entire-mail.php';  
            var post_data = form.serialize();  
            $.ajax({  
                type: 'POST',  
                url: post_url,   
                data: post_data, 

                success: function(data) {  
                    alert('Submited');
                }  


            }); 

        }); 
如果删除验证代码,则运行ajax

Ajax代码

if(!validateee()) return false; 
$('#body-enquiry').submit(function(e){  
              e.preventDefault(); 
            if(!validateee()) return false; 
             $(this).find(":submit").prop("disabled", true); 

            var form = $(this);  
            var post_url = 'enquiry-entire-mail.php';  
            var post_data = form.serialize();  
            $.ajax({  
                type: 'POST',  
                url: post_url,   
                data: post_data, 

                success: function(data) {  
                    alert('Submited');
                }  


            }); 

        }); 

您忘记在函数末尾返回true,这就是问题所在

 return true;
这需要在
validateee
函数中编写

请在此处查找更新:

你更新了
validateee
函数,更新下面的代码它会工作的我在最后检查了它

      function validateee() {
            var name = document.popbody.namebody.value;
            var email = document.popbody.emailbody.value;
            var number = document.popbody.numberbody.value.length;
            var msg = document.popbody.msgbody.value.length;
            alert('msg5');
            if(name.trim() == "") {
                alert("Please Fill Name");
                document.popbody.namebody.focus();
                return false;
            }
            alert('msg4');
            if(name<3) {
                alert("invalid Name");
                document.popbody.namebody.focus();
                return false;
            }
            alert('msg3');
            if(email=="") {
                alert("Enter Your Email");
                document.popbody.emailbody.focus();
                return false;
            }
            alert('msg2');
            if(number=="") {
                alert("Enter Your Number");
                document.popbody.numberbody.focus();
                return false;
            }
            alert('msg1');
            if(number<9) {
                alert("Your Mobile number at least 10 digit");
                document.popbody.numberbody.focus();
                return false;
            }
            alert('msg');
            if(msg == "") {
                alert("Enter your Message");
                document.popbody.msgbody.focus();
                return false;
            }

    return true;///you need to add here 
  }
函数validateee(){
var name=document.popbody.namebody.value;
var email=document.popbody.emailbody.value;
var number=document.popbody.numberbody.value.length;
var msg=document.popbody.msgbody.value.length;
警报(“msg5”);
如果(name.trim()==“”){
警告(“请填写姓名”);
document.popbody.namebody.focus();
返回false;
}
警报(“msg4”);

如果(name@Inderjeet-请检查这里:这是工作伙伴…它达到了ajax功能…现在我不知道你的url是什么