使用jquery验证和多文件上传在ajax中提交表单

loading...


0

如果数据已经在表格中提交表格,则提交表格但不提交但提交后如果更改数据事件尽管提交了旧数据(我使用print_r检查),它在控制台中显示旧数据但我更改了形式数据!没有ajax提交工作正常

验证也没有影响

$('#Employment_details').submit(function(e){

  var formData = new FormData(this);
  e.preventDefault();



   $("#Employment_details").validate({
      rules:{
        job_type:{
          required:true,
        },
        salary:{
          required:true,
        },
        working_years:{
          required:true,
          maxlength:"2"
        },
        company_name:{
          required:true,
        },
        company_address:{
          required:true,
        },
        pancard:{
          required:true,
        },
        aadhar_no:{
          required:true,
        },
        file_upload:{
          required:true,
        },
      },
      messages:{
        job_type:{
          required:"Please select an option!."
        },
        salary:{
          required:"This field is required!."
        },
        working_years:{
          required:"This field is required!."
        },
        company_name:{
          required:"This field is required!."
        },
        company_address:{
          required:"This field is required!."
        },
        pancard:{
          required:"This field is required!."
        },
        aadhar_no:{
          required:"This field is required!."
        },
        file_upload:{
          required:"This field is required!."
        },
      },
    submitHandler:function(form){
      $.ajax({
           type:'POST',
           url:"<?php echo base_url('home/job_details');?>",
           data:formData,
           cache: false,
           contentType:  false,
           processData: false,
           success:function(response){
           console.log(response); 
            if(response == "Registered successfully")
            {

                alert("You are ready to apply loan!");

            }else{
               alert("Already Registered With this Pancard and Aadhar!.");
                 }
           }
       });
     }
   });

  });

loading...

0回答

No Data

评论

暂时没有评论!