使用json_encode时Jquery Ajax无法正常工作

时间:2017-11-10 16:52:37

标签: javascript php jquery json ajax

我正试图从Jquery Ajax获得价值,但它没有得到。

问题出在下面的代码中:

<?php

header('Content-Type: application/json');
if(isset($_GET['od'])){
    $deotd = $_GET['od'];
}
date_default_timezone_set('Asia/Calcutta');
$cdate = date('Y-m-d H:i:s ', time());
$scdate = strtotime($cdate);
$e = $scdate - $deotd;
$f = "2700" - $e;

// You would calculate a real value here
echo json_encode([
  'tleft' => $f
]),
json_encode([
  'diffex' => $e
]);
?>

深入问题是:

echo json_encode([
  'tleft' => $f
]),
json_encode([
  'diffex' => $e
]);

但问题是什么,我无法解决。

0 个答案:

没有答案