我從昨天開始搜索,不知道,我無法執行,或者走錯方向。 這正與本地服務器我目前AJAX功能使用AJAX從其他服務器上獲取數據時鼠標移過
function tooltipajax(r_ID)
{
var str ;
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('span'+ r_ID).innerHTML = xmlhttp.responseText ;
}
}
xmlhttp.open("GET","accounteditajax.php?key=" +r_ID,true);
xmlhttp.send();
}
PHP代碼:
print("<tr bgcolor=\"#EEEEEF\">");
print("<td class='normal' id=\"serialno\" onMouseOver='tooltipajax(this.id)'>
<a class=\"tooltip\" >Serial Number <span id=\"spanserialno\"
class=\"custom info\"></span> </a></td>");
print("<td bgcolor = \"#FFFFFF\" ><b>$serial</b></td>\n");
print("</tr>\n");
如何從另一臺服務器獲取數據?
xmlhttp.open("GET","accounteditajax.php?key=" +r_ID,true);
我想如果你使用使用jQuery像這樣從
http://iphere/filename.php
是否其他服務器允許CORS或你有使用JSONP? –
你說這是在你的本地服務器上工作。你從其他服務器得到什麼錯誤? –
服務器允許,我沒有JSONP的想法,所以我需要此幫助 –