I have used mdb DB with the below Architecture
HTML <-> JavaScript <-> DB (mdb file)
Now I want to relpace DB with FlatFile (instead of mdb file)
HTML <--> JavaScript <--???--> DB (FlatFile)
So please guide me how to replace this
Please share sample logic to access Flatfile(DB) data using JavaScript
Try This
HTML
<input type="file" id="fileid" name="yourfile" >
Javascript
document.getElementById('fileid').onchange = function(){
var yourfile = this.files[0];
var filereader = new FileReader();
filereader.onload = function(progressEvent){
// Entire file
console.log(this.result);
// By lines
var lines = this.result.split('\n');
for(var line = 0; line < lines.length; line++){
console.log(lines[line]);
}
};
filereader.readAsText(yourfile);
};