HTML page
<form name="frm_add" id="frm_add" enctype="multipart/form-data">
<input type="text" name="fname" id="fname" >
<input type="file" name="img01" id="img01">
<input type="submit" name="btn_submit" value="Add Data">
</form>
.js page
$(function() {
$("#frm_add input, #frm_add select, #frm_add textarea").jqBootstrapValidation({
preventSubmit: true,
submitSuccess: function($form, event)
{
event.preventDefault();
//alert("It's here 001");
$.ajax({
url: "./add_p.php",
type: "POST",
data: new FormData(this),
dataType: "JSON",
contentType: false,
cache: false,
processData:false,
})
},
});
});
When I try to submit form, Ajax is not called on .js page and thus add_p.php is not called.
But if I declare action and method properties in form then add_p.php page is directly called and data are processed and inserted into database table without any issue.
<form name="frm_add" id="frm_add" action="add_p.php" method="post" enctype="multipart/form-data">
I checked all type of syntax and spelling errors but they seem ok and also read many things on internet but problem is still not resolved.
below alert is called if it is above Ajax but Ajax is not called.
alert("It's here 001");