我使用jQuery函数,jQuery的AJAX返回NULL
function ajax_fun(id,val)
{
$.ajax({
type: "GET",
url: "data.php",
dataType: "json",
data: { pid: 1, cart_id: id, val: val },
success: function (returndata){
console.log(returndata);
}
});
}
呼叫
ajax_fun(1,100);
data.php
<?php
if(isset($_GET['pid']) && $_GET['pid']==1)
{
$cart_id = $_GET['cart_id'];
$val = $_GET['val']+0.06;
$arr = array('cart_id'=> $cart_id, 'total' => $val);
json_encode($arr);
}
?>
控制台返回'空' 。它没有返回cart_id和总数。
任何人都可以帮忙吗?
。
您没有'输出'输出.. – Vishal 2012-08-09 06:49:29