I have a file containing
1 : "Benz"
2 : "Bmw"
3 : "Porche"
4 : "Ferrari"
And I would like to read it with Jquery and store them in Local Database in OpenDataBase, with 1 will be a number of step and Benz will be the other field in data base.
my code for reading the file
jQuery.get('file/words.txt', function(data) {
alert(data)
});
and my code for creating database
var db = openDatabase( ’mydb’, ’1.0’,
’database for test’,
2 * 1024 * 1024
);
db.transaction(function (tx) {
tx.executeSql(’CREATE TABLE IF NOT EXISTS Car
(number INT, name VARCHAR(100))’);
});
I don't know how can i separate the data and put them in database with javascript.
Thanks.
Here's the code do you what you want:
Output: