I tried some method for this but I couldn't do it somehow. I have a openfile dialog for choose .csv file and I've a button for start indexing data. My HTML codes like this
<body>
<div style="padding-left: 5%; padding-right: 5%; padding-top: 25px">
</div>
<div id="wrapper" style="width: 100%; text-align: left">
<img border="0" src="images//TEC.jpg" alt="TEC" width="170"
height="75">
<font size="6"> Electronic Archiving</font>
</div>
<br>
<br>
<br>
<form id="indexForm" method="post" enctype="multipart/form-data">
<div id="update" style="width:100%; text-align:left; margin-left:2.5em">
<label for="updateFile">File: </label><input type="file" id="updateFile" style="position:fixed" accept=".csv">
<br>
<br>
<div id="buton" style="margin-left:5em"><input type="button" value="UPDATE FILE" class="btn btn-sm" id="indexCSV"></div>
</div>
</form>
</body>
And my jquery like this
<script>
$(document).ready(function(){
$("#indexCSV").click(function(){
var file=document.getElementById("updateFile").files[0];
var formData=new FormData();
formData.append('file',file);
$.ajax({
type:'POST',
url:'http://localhost:8983/archiveCore/update?commit=true',
dataType:'csv'
contentType:'text/csv',
processData:false\
data:'formData',
success:function(){
window.alert("Data uploaded : ")
}
});
});
});
</script>
When I'm clicking the button there is no action. I don't understand why.