大家取个例子吧

解决方案 »

  1.   

    不能这样的,php要转化为 xml 或者 json ,前台用 js来解释
      

  2.   

    有什么插件没有呢?
    以前在JSP里面用jsonrpc,写逻辑函数可以直接返回数组
      

  3.   

    $arRet = array( "error" => false, array( 'user', 'pass' ) );echo json_encode( $arRet );
      

  4.   

    ajax返回数据有什么用呢?
    你问的问题不对吧。
    应该是php怎么返回json字符窜吧?
    ajax一般可以处理html,json和xml三种数据,其中json是最方便使用的,关于大量数据php最好放回json字符窜。
      

  5.   

    方法1 返回json方法2 把你想要输出的直接输出出来。
    客户端仅做 $('#id').html(data);
      

  6.   

    php 二維數組. $sql_table="SELECT t.table_id,t.opentable_id,t.table_number,t.table_name,t.table_layout_id,t.table_room_layout_id,t.table_sum,t.table_state,l.layout_name FROM `tables` as t left join layouts l on t.table_layout_id=l.layout_id $where order by t.table_id asc";
    // echo $sql_table;
        $result_tables=select($sql_table,$link);
        $arry=array();
        if($result_tables and mysql_num_rows($result_tables)>0)
        {
      while($rows=mysql_fetch_assoc($result_tables))
      {
                  $table_id=$rows["table_id"];
                  $table_sum=$rows["table_sum"];
                  $table_name=$rows["table_name"];
                  $layout_name=$rows["layout_name"];
                  $opentable_id=$rows["opentable_id"];
                  $totle=0;
                  if(intval($rows["table_state"])==2)
                  {
                         $a=get_totle($opentable_id);
                         $totle=$a;
                  }              $table_state=$rows["table_state"];
                $arry[]=array("table_id"=>$table_id,"table_sum"=>$table_sum,"table_name"=>$table_name,"layout_name"=>$layout_name,"totle"=>$totle,"table_state"=>$table_state,"opentable_id"=>$opentable_id);
      }
    //   print_r($arry);
      $json_string = json_encode($arry);
      echo $json_string;
        }