AJAX xmlHttp.readyState的返回值总是1代码如下:function QP2001_JF2001_Click(sCode,sPrtPrj,sReferFlag) {var tStrUrl;var tStrCondition;tStrCondition = " AND a.cContractCode = '" + sCode + "' "+ " AND f.cPPCode = '" + sPrtPrj + "'";tStrUrl = "

来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/26 07:22:18
AJAXxmlHttp.readyState的返回值总是1代码如下:functionQP2001_JF2001_Click(sCode,sPrtPrj,sReferFlag){vartStrUrl;v

AJAX xmlHttp.readyState的返回值总是1代码如下:function QP2001_JF2001_Click(sCode,sPrtPrj,sReferFlag) {var tStrUrl;var tStrCondition;tStrCondition = " AND a.cContractCode = '" + sCode + "' "+ " AND f.cPPCode = '" + sPrtPrj + "'";tStrUrl = "
AJAX xmlHttp.readyState的返回值总是1
代码如下:
function QP2001_JF2001_Click(sCode,sPrtPrj,sReferFlag) {
var tStrUrl;
var tStrCondition;
tStrCondition = " AND a.cContractCode = '" + sCode + "' "
+ " AND f.cPPCode = '" + sPrtPrj + "'";
tStrUrl = "../qp/QP2001_A.aspx?MODE=SEARCH"
+ "&CONDITION=" + escape(tStrCondition)
+ "&SHOWMODE=" + sReferFlag
+ "&OTHER=REFER";
xmlHttp.open("GET",tStrUrl,true );
xmlHttp.onreadystatechange = QP2001_JF2001_Click_HttpResponse;
xmlHttp.send(null);
return true;
}
function QP2001_JF2001_Click_HttpResponse() {
if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
var xmlDoc = xmlHttp.responseXML;
if (xmlDoc.documentElement) {
var tStrStatus = xmlDoc.getElementsByTagName("STATUS")[0].text;
var tStrDoc;
if (tStrStatus == "OK") {
var tIntDatanum = xmlDoc.getElementsByTagName("DATANUM")[0].text; //记录数
if (tIntDatanum == 0) {
alert("没有可操作数据.");
return false;
}else{
alert("OK");
}
}else{
alert(tStrStatus);
return false;
}
}
}
}
里面xmlHttp.readyState的返回值总是1
MaxMartin 的回答,各返回值的意义我知道,主要是不知道为啥会总返回1
服务端代码
Web.HttpContext.Current.Response.Clear()
Web.HttpContext.Current.Response.ContentType = "text/xml"
Web.HttpContext.Current.Response.AddHeader("Content-Type","text/xml; charset=utf-8")
Web.HttpContext.Current.Response.AddHeader("Cache-Control","no-cache,private")
Web.HttpContext.Current.Response.AddHeader("Pragma","no-cache")
tStrXml = "" & vbNewLine & _
"" & vbNewLine & _
" OK" & vbNewLine & _
" " & tStrMode & "" & vbNewLine & _
" JF2004" & vbNewLine & _
tStrXmlText & vbNewLine & _
""
Web.HttpContext.Current.Response.Write(tStrXml)
Web.HttpContext.Current.Response.End()

AJAX xmlHttp.readyState的返回值总是1代码如下:function QP2001_JF2001_Click(sCode,sPrtPrj,sReferFlag) {var tStrUrl;var tStrCondition;tStrCondition = " AND a.cContractCode = '" + sCode + "' "+ " AND f.cPPCode = '" + sPrtPrj + "'";tStrUrl = "
用这个ajax的封装,绝对没有问题
$ajax=function(){};
$ajax.ajax = function(ob){
if (!ob.url)
return;
var xmlhttp = (function(){
try {
return new XMLHttpRequest(); // Firefox,Opera 8.0+,Safari IE7
}
catch (e) {
if (window.ActiveXObject) {
var ActiveXName = ['MSXML2.XMLHttp.5.0','MSXML2.XMLHttp.4.0','MSXML2.XMLHttp.3.0','MSXML2.XMLHttp','Microsoft.XMLHttp'];
for (var i = 0; i < ActiveXName.length; i++) {
try {
return new ActiveXObject(ActiveXName[i]); //Internet Explorer 5.0+
}
catch (e) {
return false;
}
}
}
else {
return false;
}
}
})();
var type = ob.type || "get";
var asyn = ob.asyn || true;
if (xmlhttp) {
xmlhttp.open(type,ob.url,asyn);
xmlhttp.onreadystatechange = function(){
if (xmlhttp.readyState != 4) {
//如果before在object内,就运行,否则就不运行
//一般用作loading
if (ob.before) {
ob.before();
}
}
else {
//这个success函数必须要有!
//注意,success函数传入了值进去
//或者仅仅把xmlhttp传入success也可以,然后在success的function里面写var tempText=xmlhttp.responseText 也可以的.
//或许这个以后会做修改,目前还是直接把返回的文本给success,因为这个还是很常用的
//如果新加入了一个xml,参数为true,说明传进来的是xml[这样的话就传xmlhttp,像怎样就怎样],默认是得到它的txt
ob.xml ob.success(xmlhttp) :ob.success(xmlhttp.responseText);
}
};
//这个好像可以解决IE ajax请求缓存的问题,如果不行,就把它注释吧,正在测试
xmlhttp.setRequestHeader("If-Modified-Since","0");
//xmlhttp.setRequestHeader("Cache-Control","no-cache");
xmlhttp.send(null);
}
else {
//如果error在obeject内,就运行,否则就不运行
if (ob.error) {
ob.error();
}
}
};

ajax里xmlhttp.readyState==4 && xmlhttp.status==200是什么意思小弟刚刚接触ajax,请各位老大们帮忙解释下,谢谢了!!!!!! Ajax中的代码解释?xmlHttp.readyState==4和xmlHttp.readystate==4大小写有关系吗?if(xmlHttp.readyState==4){alert(xmlHttp.status) ;if(xmlHttp.status==200){// document.getElementById(tData).innerHTML = xmlHttp.responseText ;var logMessage = AJAX xmlHttp.readyState的返回值总是1代码如下:function QP2001_JF2001_Click(sCode,sPrtPrj,sReferFlag) {var tStrUrl;var tStrCondition;tStrCondition = AND a.cContractCode = ' + sCode + ' + AND f.cPPCode = ' + sPrtPrj + ';tStrUrl = cannot allocate xmlhttp . ; cannot allocate xmlhttp; 什么是ajax异步请求 Ext.lib.Ajax.request()原理? xmlhttp.readystate总是等于1怎么解决 struts2 + jsonInsert title here function getAjaxObject(){ var xmlhttp=null; if(window.XMLHttpRequest){ xmlhttp=new XMLHttpRequest(); }else{ xmlhttp=new ActiveXObject(Microsoft.XMLHTTP); } return xmlhttp; } function tt(){ var us ajax异步请求如何理解RT ajax 这个单词是啥米意思哩?3Q Ajax中的get和post两种请求方式的异同 英语翻译How does AJAX work?When an application uses AJAX,a new layer is added to the communication model.Inthe classic web application,communication between the client (the browser) and the webserver were performed directly,using HTTP requests.Ti 请问EXT是什么?我目前的进度是c# 和ASP入门AJAX框架是什么?框架是什么? ajax里的timestamp=+new Date().getTime() ;xmlReq.open(post,../jsonServlet?timeStamp=+new Date().getTime(),true); I often write to eileen and tell her about all the things that are happening at the Ajax Compangy翻 下面关于Ext.Ajax.request方法中的callback回调函数说法错误的是()我选的c 是错的 邮政网银登陆不上去.一直提示cannot allocate xmlhttp,重做了几次系统好上个一天,第二天还是这样.问题出现在那了.今天又成这样了,