第一次 调用可以 第二次就报错了 status=0
我的代码如下 大虾 帮忙想想办法
function cheap(cheap_count,pcatid)
{
var xmlhttp=CreateXMLHttpRequest(); //创建对象 var showurl = "http://www.xxx.com/product/cheap.php?cheap_count="+cheap_count+"&pcatid="+pcatid+"&sand="+Math.random();//构造URL
xmlhttp.onreadystatechange = function(){
/* alert(xmlhttp.readyState+'-----'+xmlhttp.status);*/
if(xmlhttp.readyState == 4 && xmlhttp.status == 200 )
{
var rs=xmlhttp.responseText;
if(rs==2){
alert('数位板 + 活动配件 -> 使用代金卷');
}else if(rs==1){
alert('数位板 + 活动配件 -> 使用代金卷');
}else if(rs>0){
if(confirm("您确定使用配件优惠卷吗")){
document.getElementById('showcheap').style.display='block';
document.getElementById('cheap_count').innerHTML=rs+'.00';
var mount=document.getElementById('mount').innerHTML;
document.getElementById('mount').innerHTML=eval(mount-rs)+'.00';
document.getElementById('cheap').innerHTML='<font color="gray" size="3px">使用配件优惠卷</font>';
}
}else{
alert('对不起,您的优惠券已经用完!');
}
}
}; //判断URL调用的状态值并处理
xmlhttp.open("GET", showurl, true); //调用test.html
xmlhttp.setRequestHeader("Cache-Control","no-cache");
xmlhttp.send(null); //设置为不发送给服务器任何数据}
我的代码如下 大虾 帮忙想想办法
function cheap(cheap_count,pcatid)
{
var xmlhttp=CreateXMLHttpRequest(); //创建对象 var showurl = "http://www.xxx.com/product/cheap.php?cheap_count="+cheap_count+"&pcatid="+pcatid+"&sand="+Math.random();//构造URL
xmlhttp.onreadystatechange = function(){
/* alert(xmlhttp.readyState+'-----'+xmlhttp.status);*/
if(xmlhttp.readyState == 4 && xmlhttp.status == 200 )
{
var rs=xmlhttp.responseText;
if(rs==2){
alert('数位板 + 活动配件 -> 使用代金卷');
}else if(rs==1){
alert('数位板 + 活动配件 -> 使用代金卷');
}else if(rs>0){
if(confirm("您确定使用配件优惠卷吗")){
document.getElementById('showcheap').style.display='block';
document.getElementById('cheap_count').innerHTML=rs+'.00';
var mount=document.getElementById('mount').innerHTML;
document.getElementById('mount').innerHTML=eval(mount-rs)+'.00';
document.getElementById('cheap').innerHTML='<font color="gray" size="3px">使用配件优惠卷</font>';
}
}else{
alert('对不起,您的优惠券已经用完!');
}
}
}; //判断URL调用的状态值并处理
xmlhttp.open("GET", showurl, true); //调用test.html
xmlhttp.setRequestHeader("Cache-Control","no-cache");
xmlhttp.send(null); //设置为不发送给服务器任何数据}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货