Inserting result of a SQL Query into html side
Hello,
i've got a question about inserting a result of a SQL query into a html template.
I've got a function which sends a query to a client side database und should afterwards show the result on the html side. Here is my function:
- function refreshEntries() {
db.transaction
(
function(transaction)
{
transaction.executeSql
(
'SELECT * FROM test WHERE id = 1;',
function (transaction, result)
{
var row = result.rows.item(0);
var newEntryRow = $('#personaldata');
newEntryRow.find('.name').text(row.name);
newEntryRow.find('.personalnr').text(row.persnr);
newEntryRow.find('.firma').text(row.firma);
newEntryRow.find('.mobilenr').text(row.mobilenr);
},
errorHandler
);
}
);
- }
I do not realley know what i am doing wrong, but the html side doesn't show anything. I start this function in the document ready function:
- $('#settings li a').click(refreshEntries);
and my html looks like this:
- <div id="personaldata">
<div class="toolbar">
<h1>Persönliche-Daten</h1>
<a class="button back" href="#">Back</a>
</div>
<form method="post">
<ul class="rounded">
<li><input placeholder="Name" type="text" name="name" id="name" /></li>
<li><input placeholder="Personalnr." type="text" name="personalnr" id="personalnr" /></li>
<li><input placeholder="Firma" type="text" name="firma" id="firma" /></li>
<li><input placeholder="Mobile-Nr." type="text" name="mobilenr" id="mobilenr" /></li>
<li><input type="submit" class="submit" name="action" value="Speichern" /></li>
</ul>
</form>
</div>
I hope someone can help me, Thank you very much!!