$.ajax({
type: "post",
url: url,
// data: "para="+para, 此处data可以为 a=1&b=2类型的字符串 或 json数据。
data: {"liveid":liveid},
cache: false,
async : false,
dataType: "json",
success: function (data ,textStatus, jqXHR)
{
if("true"==data.flag){
alert("您已观看15分钟,积分已到账!");
return true;
}else{
alert("不合法!错误信息如下:"+data.errorMsg);
return false;
}
},
error:function (XMLHttpRequest, textStatus, errorThrown) {
alert("请求失败!");
}
});
PHP返回数据
<?
$data['flag'] = true;
return $data;
?>