This is my javascript code that will be invoked when user click the Browse button in HTML:
function run(){
console.log('run();')
document.getElementById('csv_file_upload').addEventListener('change', read_csv, false);
$('#csv_file_upload').click(function() {
location.reload();
console.log('reload();');
});}
And this is part of my HTML code:
<div id="dvImportSegments" class="fileupload ">
<fieldset>
<legend>Upload your CSV File</legend>
<input type="file" name="File Upload" id="csv_file_upload" accept=".csv" onclick="run();" />
</fieldset>
</div>
<div id="data-display"></div>
Below is the screenshot to specify my question:
1)This is how my page looks like:
2)And when I click the Browse button, it will run the run() function in javascript.
3)After I select my data, the other part of function will do their part. So far so good.
4)And then, when I want to browse another .csv file, I click the Browse button and once I click it, JQuery reload() will be activated and the previous things inside the div will be cleared automatically while I select another csv file. The problem arise when I select another csv file. The page won't run the run() in the javascript.
5)And nothing came out from the reloaded page. Why is it like that? Is there any explanation? Can someone help me on this matter?