Reputation: 53
How can I connect an HTML5 web application to a sqlite database which is on server side?
Upvotes: 1
Views: 4461
Reputation: 4111
You need to use a server-side language such as php (or any other server-side language that has support for sqlite databases). A client-side application can't access anything on the server other than information exposed as http services (a web page or json web service for example). Your html5 application can use ajax to make the http request to the server-side script which actually makes the sqlite database queries and returns the information to your application. Using a good client-side library like jquery can make the ajax calls quite easy:
$.getJSON("path/to/server-side-script.php", function(dataReturned){
alert(dataReturned);
};
The code above is just an example - it may not be exactly correct, but you should get the idea. I won't put an example of what the server-side script would do to retrieve the data from sqlite and return it as JSON (or whatever data format you like) - they are easily found with a quick google/bing search.
Upvotes: 1
Reputation: 5818
Here are the blogs which explains connecting sqllite with html5
SQL Lite Class for HTML5 Database
Upvotes: 1