javascript - In alert it is showing the data but not in home screen -


i using phonegap sqlite, , facing problem data not displaying. alert(scripts) showing data there, not showing on home screen. me figure out mistake have done in code.

thanks in advance.

in jquery:

function get_emp_list() {                         $("#employee").empty();             $(location).attr('href', '#emp1');            $.support.cors = true;               $.ajax({                 type: "get",                 url: "one.html",                 contenttype: "text/xml",                 datatype: "xml",                 data: "",             crossdomain:true,                 success: function (data) {                                             $(data).find("employee").each(function () {                               var emp_id = $(this).find('id').text();                           var emp_name = $(this).find('short_name').text();                              db.transaction(function(transaction) {                                  transaction.executesql('insert envy_emp values((select max(_idee)+1 envy_emp),"'+emp_id+'","'+emp_name+'")',nullhandler,errorhandler);                             });                              });                                           ids_dynamic_emp_list();                            return false;                        },                 error: function (data) {                         alert("error");                 }             });        }        /*  end employee list script */     /*ids_dynamic_emp_list() method coding start*/     function ids_dynamic_emp_list(){   /*sql start*/    /*sqlite code dynamic emp list*/   db.transaction(function(tx){     tx.executesql('select * envy_emp;', [],           function(tx,results){                     if (results != null && results.rows != null) {                      var mylen=results.rows.length;                      (var = 0; < results.rows.length; i++) {                          var for_name = results.rows.item(i).envy_emp_name;                          var for_id = results.rows.item(i).envy_emp_id;                          var for_e_id=results.rows.item(i)._idee;                         /*create table list dynamically using sqlitedata base */                              var scripts = "<a href='#' data-role='button' data-theme='b' data-inline='true' onclick='get_menu_list(id);' id='"+for_e_id+"'>"+for_name+"</a>";                              alert(scripts);                           $(".employee1")                           .append(scripts)                           .trigger('create');                         /*create table list dynamically using sqlitedata base end*/                          }                       }                    },errorhandler);                   }                  ,errorhandler,nullhandler);                  return;                    } 

in html:

<div data-role="page" id="emp1">   <div date-role="content">     <div id="employee" class="employee1"/>   </div> </div> 

can please try this.

in function call function , pass data, instead of appending codes. in called function, append passed data.

function ids_dynamic_emp_list(){   /*sql start*/    /*sqlite code dynamic emp list*/   db.transaction(function(tx){   tx.executesql('select * envy_emp;', [],           function(tx,results){                     if (results != null && results.rows != null) {                      var mylen=results.rows.length;                      (var = 0; < results.rows.length; i++) {                               appendscripts(results.rows.item(i)); /*call function*/                          /*create table list dynamically using sqlitedata base end*/                          }                       }         },errorhandler);    },errorhandler,nullhandler);    return;  } 

then append data here,

    /*function appends data div*/     function appendscripts(values){           var for_name = values.envy_emp_name;           var for_id = values.envy_emp_id;           var for_e_id= values._idee;            /*create table list dynamically using sqlitedata base */           var scripts = "<a href='#' data-role='button' data-theme='b' data-inline='true' onclick='get_menu_list(id);' id='"+for_e_id+"'>"+for_name+"</a>";           $(".employee1").append(scripts).trigger('create');     } 

update found issue html 5, change html to,

<div data-role="page" id="emp1">        <div date-role="content">           <div id="employee" class="employee1"></div>        </div>  </div> 

Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -