Json Parse错误

时间:2016-02-20 13:04:23

标签: php jquery json

我的控制台日志中有错误

SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
jquery-2.2.0.js:7961:9
ReferenceError: $json is not defined

当我在xammp上在我的电脑上工作时,一切正常。但是当我上传我的网站时,它有这些错误。

date.php

$link = mysqli_connect("localhost","root","") or die ("Error: Unable TO CONNECT Mysql Server, Check Username and Password.");
 mysqli_select_db($link,"log") or die ("Error: Unable TO Connect , Create  DB.");
  mysqli_query($link,'set names "utf8"') or die("error");
  date_default_timezone_set('Asia/Tehran');
  include 'jdf.php';
  $i=1394;$j=0;$k=0;$m=0;
  $date = date("Y-m-d");
 $count=array();
$yM=array();
$arr=explode("-",$date);
$jalali=gregorian_to_jalali($arr[0],$arr[1],$arr[2],"/");
$exJalali=$arr=explode("/",$jalali);
$year=$exJalali[0];
for($i=1393,$k=0;$i<=$year;$i++,$k++){
  for($j=1,$m=0;$m<12;$j++,$m++){
    $query="select * from tracker where (year='$i' AND mounth='$j')";
    $result=mysqli_query($link,$query);
    $count[$m]=mysqli_num_rows($result);
   }
    $yM[$k]=$count;
   }
   mysqli_close($link);
    echo json_encode($yM);

custom.js

var url = 'date.php';
$.ajax({
    url : url,
    async : false,
    success : function(response){
        $json = $.parseJSON(response);
   }
});
var arrLength=$json.length +1393;

0 个答案:

没有答案