I am working on a phonegap app. I am facing some problem while passing value that I am getting from sqlite DB to jquery function. I am passing a simple date variable to onclick = popUP("+date+");, but on the receiving end I am getting some different value. For example if date contains 2015-02-24 the popUP is receiving 1989. Here is my code
//function will be called when process succeed function resultSuccess(tx,response) {
for(var i=0;i<response.rows.length;i++){
date = response.rows.item(i).ARTI_DATE;
//alert("Title is : " +response.rows.item(i).ARTI_TITLE +"Date is : "+response.rows.item(i).ARTI_DATE+ "Des is : "+response.rows.item(i).ARTI_DESCRIP);
var margin = 10;
$("#routeContainer").append("<div style = 'margin-left: " + margin + "px;' class = 'test' id='d"+i+"' onclick='popUp("+date+")'><p style='padding-top: 90px;'><b>Thought for the..</b> <br/>Date: <span id='t"+i+"'>"+date+"</span> </p></div> ");
$('.test').css('background', 'url(img/thumbs/thought.jpg) no-repeat').height(100).width(100);
//$('.test').append($('<input></input>').attr('id','d'+i).attr('type','hidden').attr('value',date));
}
}
function popUp(d) { alert("Value is " +d); var db = window.openDatabase("DEVICEDATA", "1.0", "Device data", 200000); //will create database DEVICEDATA
db.transaction(SelectDesc, resultError, resultSuccess); }
Aucun commentaire:
Enregistrer un commentaire