ajax放回值问题
时间:2011-05-04
来源:互联网
用asp做一个级联查询,在放回值处出现问题,我返回的是<select></select>下拉列表,出现的问题是用xmlHttp.responseXML()能取到到值,但是是object,xmlHttp.responseText(),用alert()打印却什么也没有,空的,不知为什么?
作者: zeldazhang 发布时间: 2011-05-04
以字符串返回 应该不会是object的
作者: W3031213101 发布时间: 2011-05-04
xmlHttp.responseText(),
responseText是属性,你加()干吗?!
responseText一定会有值的【除非没有输出】,responseXML不一定有时真的【需要设置响应头为text/xml】
responseText是属性,你加()干吗?!
responseText一定会有值的【除非没有输出】,responseXML不一定有时真的【需要设置响应头为text/xml】
作者: showbo 发布时间: 2011-05-04
引用 1 楼 w3031213101 的回复:
以字符串返回 应该不会是object的
以字符串返回 应该不会是object的
以下是我从数据库取出的值,也就是要返回的值的代码
Set rsl = Conn.Execute("select level_id , level_name from typework_level where typework="&level&"")
if rsl.eof and rsl.bof then
set rsl = Nothing
Response.Write "<select name=""levle_id"" id=""level_id""><option value="""">----暂无信息----</option></select>"
Response.End()
else
Response.Write "<select name=""levle_id"" id=""level_id"">"
Response.Write "<option value="""">----请选择----</option>"
do while not rsl.eof
Response.Write "<option value="""&rsl("level_id")&""">-"&rsl("level_name")&"-</option>"
rsl.movenext
loop
Response.Write "</select>"
set rsl = Nothing
end if
我也设置了响应头
<%
Response.CodePage = 65001
Response.Charset = "UTF-8"
response.ContentType ="text/xml"
%>用alert(responseText)就是空,打印responseXml,返回的是object
作者: zeldazhang 发布时间: 2011-05-04
引用 2 楼 showbo 的回复:
xmlHttp.responseText(),
responseText是属性,你加()干吗?!
responseText一定会有值的【除非没有输出】,responseXML不一定有时真的【需要设置响应头为text/xml】
xmlHttp.responseText(),
responseText是属性,你加()干吗?!
responseText一定会有值的【除非没有输出】,responseXML不一定有时真的【需要设置响应头为text/xml】
我给打错了,我代码里没有加(),我有输出,单执行那个从数据库取值的页面,出来的效果是个下拉列表
代码如下:
Set rsl = Conn.Execute("select level_id , level_name from typework_level where typework="&level&"")
if rsl.eof and rsl.bof then
set rsl = Nothing
Response.Write "<select name=""levle_id"" id=""level_id""><option value="""">----暂无信息----</option></select>"
Response.End()
else
Response.Write "<select name=""levle_id"" id=""level_id"">"
Response.Write "<option value="""">----请选择----</option>"
do while not rsl.eof
Response.Write "<option value="""&rsl("level_id")&""">-"&rsl("level_name")&"-</option>"
rsl.movenext
loop
Response.Write "</select>"
set rsl = Nothing
end if
我也设置了响应头
<%
Response.CodePage = 65001
Response.Charset = "UTF-8"
response.ContentType ="text/xml"
作者: zeldazhang 发布时间: 2011-05-04
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28