52,782
社区成员
发帖
与我相关
我的任务
分享function ajaxService(url)
{
createXMLHttp();
//xmlHttp.open("GET",url,true);
xmlHttp.open("GET",url,false); //同步提交
//xmlHttp.onreadystatechange = callback;
xmlHttp.send(null);
return xmlHttp.responseText//=====================要注意要返回,要不就是默认返回undefined
} function callback()
{
if(xmlHttp.readyState == 4)
{
if(xmlHttp.status == 200)
{
//========================不需要return,你return了也没用
ajaxResult = xmlHttp.responseText;
alert(ajaxResult)
}
}
} ajaxService("service.php?_dc="+new Date());