I am trying to upload a file and sending it through AJAX.. but i am getting below error..
Notice: Undefined index: xlsFile in
Below is my Coding :
HTML FORM : (this form is in Modal Popup)
<form id="form2" class="importModal" enctype="multipart/form-data">
Upload Excel File : <input type="file" name="xlsFile" id="xlsFile" />
<button type="button" id="addType" name="addType">Submit</button>
</form>
AJAX Code :
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script>
$(document).ready(function () {
$("button#addTripType").click(function(){
alert("hello");
$.ajax({
type: "POST",
url: "ajax-Upload.php", //
data: $('form.importModal').serialize(),
success: function(msg){
alert("success");
},
error: function(){
alert("failure");
}
});
});
});
</script>
What should i Do..??? Need Help..??