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;
}
} );