52,780
社区成员
发帖
与我相关
我的任务
分享var xmlHttp;
function S_xmlhttprequest(){
if(window.ActiveXObject){
xmlHttp=new ActiveXObject('Microsoft.XMLHTTP');
}else if(window.XMLHttpRequest){
xmlHttp = new XMLHttpRequest();
}
}
function add(url){
S_xmlhttprequest();
xmlHttp.open("GET","add.php?id="+url,true);
xmlHttp.onreadystatechange=byphp();
xmlHttp.send(null);
}
function byphp(){
var byphp100=xmlHttp.responseText;
document.getElementById('aa').innerHTML=byphp100;
}<?php
if($id=$_GET[id]){
for($i=1;$i<20;$i++){
echo $id;
}
exit();
}
?><script src="ajax.js" type="text/javascript"></script>
<a class="yellow_link" href="" onclick="add('1')">选择优惠券</a>
<div id="aa"></div>function add(url){
S_xmlhttprequest();
xmlHttp.open("GET","add.php?id="+url+'&_dc='+new Date().getTime(),true);//防IE缓冲
xmlHttp.onreadystatechange=byphp//================();
xmlHttp.send(null);
}
function byphp(){
if(xmlHttp.readyState==4){//要在状态为4时才能使用xhr对象的responseText属性,要不出错
var byphp100=xmlHttp.responseText;
document.getElementById('aa').innerHTML=byphp100;
}
}<?php
if($id=$_GET["id"]){//=========你这句判断有问题吧,没见你给$id赋值,$_GET也没用对吧。。
for($i=1;$i<20;$i++){
echo $id;
}
exit();
}
?>