js ajax 的实例
function dcj_jubao(goods_id,reason)
{
var xmlhttp;
if(window.XMLHttpRequest)
{
xmlhttp = new XMLHttpRequest();
}
else
{
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function()
{
if(xmlhttp.readyState == 4 && xmlhttp.status == 200)
{
var xx = xmlhttp.responseText;
var data = JSON.parse(xx);
if(data.status == 1)
{
alert("举报成功,谢谢!管理员会尽快处理!");
}
else
{
alert("举报失败!请稍后再试!");
}
}
}
var url = "sale.php?goods_id="+goods_id+"&reason="+reason+"&mod=jubao";
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}