ajax在firefox浏览器中运行,在服务上没有反应,但在本地有反应
<script type="text/javascript">
var xmlHttp;
function createXMLHttpRequest()
{
if(window.ActiveXObject){
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}else if(window.ActiveXObject){
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP.4.0");
}else if(window.ActiveXObject){
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP.6.0");
}else if(window.ActiveXObject){
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP.3.0");
}else if(window.ActiveXObject){
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
}else if(window.XMLHttpRequest){
xmlHttp = new XMLHttpRequest();
}
}
//处理方法
function history(s)
{
createXMLHttpRequest();
var strName=s;
var url= "HistoryADD.aspx?strUsername="+strName;//这里你想传什么值就传什么值吧,AjaxHandler.ashx为你要进行数据处理的页
xmlHttp.open("POST",url,true);
xmlHttp.send(null);
}
</script>
代码如上。将strName变量传入HistoryADD.aspx文件,HistoryADD.aspx文件进行写入数据库,用firefox浏览器测试,在本地是可以写入;但网页传到服务上运行就不能写入了,不知道为什么?问题出在哪里?请大家指教!谢谢!