前端之家收集整理的这篇文章主要介绍了
基础Ajax发送请求,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
function goAjax(para)
{
var xmlHttp = null;
var time = new Date();
var flash = time.getTime();
try
{// Firefox,Opera 8.0+,Safari,IE7
xmlHttp = new XMLHttpRequest();
}
catch (e)
{// Old IE
try
{
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
alert("Your browser does not support XMLHTTP!");
return;
}
}
xmlHttp.open("Get","<%=path%>/test.action?para=" + para
+ "&flash=" + flash,false);
xmlHttp.send(null);
var returnData = xmlHttp.responseText;
return returnData;
}