Home  >  Article  >  php教程  >  json_encode用法

json_encode用法

WBOY
WBOYOriginal
2016-06-13 11:31:201667browse

$query=mysql_query($SQL);
 while($row = mysql_fetch_array($query)){
        $xdata[]=$row['EventDate'];
         $ydata[]=intval($row['data']);
    }

  $data_arr=array($xdata,$ydata)

  json_encode($data_arr);

 

$.ajax({
   type: "Get",  
   url: "columndata.php?r=" + Math.floor(Math.random() * 1000 + 1),
   data: { 'BeginTime': "" + beginTime + "", "EndTime": "" + endTime + "" , "keyword": "" + keyword + "" },
   dataType: "text",  
   global: false, 
   async: false,  
   success: function (strReult) {
    if (strReult == "-1") { alert("fail!"); return; }
            
 


   },
   error: function () {
    alert("fail!");
   }
  });

 

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn