<script>
function showPrice(str)
{
if (str=="")
{
document.getElementById("remaining").innerHTML="";
return;
}
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("remaining").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","getevent.php?q="+str,true);
xmlhttp.send();
}
</script>
以下代碼將數據返回給相應的div,但是當我看到源代碼時,我無法找到新插入的代碼。我想將返回的數據寫入html的div標記
爲什麼當你不使用它時將它標記爲jQuery? – Johan 2013-02-12 15:53:11
你是如何查看你的源代碼的?右鍵單擊 - >查看源代碼或使用類似Chromes開發工具的調試工具? – webnoob 2013-02-12 15:53:29
如果您使用'jQuery',請考慮使用jQuery ajax:http://api.jquery.com/jQuery.ajax/ – karthikr 2013-02-12 15:53:57