json - How do you populate php results into a jquery mobile listview -


i have php below html code. im trying populate listview php code failing, ideas

<? require_once("../backend/functions.php"); dbconn();  $id = $curuser["id"];  $e  = date("y/m/d");               $a  = sql_query_exec("select enddate cal_events userid = '$id'                         , enddate > '$e' order enddate asc");  if (mysql_num_rows($a) == 0) { ?>   <script>     alert("you have no active events deal with");    window.location ='index.html';    </script>  <? }else{    $data = array();   while($rowa = mysql_fetch_array($a))   {      $data[] = $rowa;   }   echo json_encode($data); } 

now html not correct , need little in right direction

html

<script type="text/javascript">   $(document).on("pagebeforeshow", "#index4", function() {     $(function(){       var items="";       $.getjson("check-events.php",function(data){         $.each(data,function(index,item)          {           items+="<li>"+item.enddate+"</li>";         });         $("#contacts").html(items);          $("#contacts").trigger("change");       });     });   });   </script> <ul id="contacts" data-role="listview" data-divider-theme="b" data-inset="true"> </ul> 

where going wrong? populate list no jquery elements

you must refresh listview not trigger:

$("#contacts").listview("refresh"); 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -