upload both form and file using ajax in jquery validation plugin in php -


these form

    <form action="<?php echo base_url();?> candidate/ajaxadd" name="candidate_form" method="post" id="candidate_form" enctype="multipart/form-data">  

these ajax function in jquery validation plugin

    submithandler: function(form) {               var formdata = new formdata($(this)[0]);             $.ajax({                 url: form.action,                 type: form.method,                 data: formdata,                 async: false,                 complete: dispaly_candidate,                 success: function(response) { alert(response);                     if(response == "false"){                         alert("please enter fields");                     }                 },                 cache: false,                 contenttype: false,                 processdata: false                         }); 

i don't understand question but:

   submithandler = function(form) {                 var formurl = form.attr("action");                 var formdata = form[0];                 var formdata = new formdata(formdata);                 $.ajax({                     url: formurl,                     type: "post",                     data: formdata,                     mimetype: "multipart/form-data",                     contenttype: false,                     cache: false,                     processdata: false,                     success: function(data) {                         var response=$.trim(data);                         alert(response);                         if(response === "false"){                             alert("please enter fields");                         }                     }                           });              };     // use finction:     submithandler($("#candidate_form")); 

you need ask question in detail. , function correction (i guess) you're looking for.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -