public function GetJson(){
        $query="select * from table";
        $result = mysql_query($query);
        $rows = array();
        while($row = mysql_fetch_array($result)){
            $rows []= $row;
         }
        echo json_encode($rows);
}

js处理

        $.get( "./bll.php", option,
                  function(data ) {
                    var jsonx=eval(data);//此处对data通过eval处理

 var pageSize=jsonx.length>10?10:jsonx.length;
    for(var count= 0 ;count<pageSize;count++)
    {
      var cls=(i%2==0)?"even":"odd";
      var id=jsonx[count].id;
      var sname=jsonx[count].question;
  }
} );

 

相关文章:

  • 2022-12-23
  • 2021-10-15
  • 2021-07-16
  • 2022-12-23
  • 2021-12-10
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-05-29
  • 2022-12-23
  • 2022-12-23
  • 2022-01-08
  • 2021-06-05
  • 2021-12-21
相关资源
相似解决方案