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
Post a Comment