Hello Sir,
i am facing problem when i browse excel file in excel there is multiple sheet is there like sheet1, sheet2, sheet3 etc. i want to bind this sheet in dropdown with id and sheetname so that page will not refresh.
<input type="file" name="file" class="form-control" id="Masterid" required="required" accept=".xls,.xlsx" />
<script type="text/javascript">
$('#Masterid').on('change', function (e) {
debugger;
var files = e.target.files;
//var myID = 3; //uncomment this to make sure the ajax URL works
if (files.length > 0) {
if (window.FormData !== undefined) {
var data = new FormData();
for (var x = 0; x < files.length; x++) {
data.append("file" + x, files[x]);
}
$.ajax({
type: "POST",
url: 'https://localhost:44389/api/BindExcel/save',
contentType: false,
processData: false,
data: data,
success: function (result) {
console.log(result);
},
error: function (xhr, status, p3, p4) {
var err = "Error " + " " + status + " " + p3 + " " + p4;
if (xhr.responseText && xhr.responseText[0] == "{")
err = JSON.parse(xhr.responseText).Message;
console.log(err);
}
});
} else {
alert("This browser doesn't support HTML5 file uploads!");
}
}
});
</script>
this script not send the data in web api giving error