responsetext返回的是什么(Xmlhttprequest.responseText返回的是什么格式)

本文目录
- Xmlhttprequest.responseText返回的是什么格式
- 为什么jqXHR.responseText返回一个字符串,而不是一个JSON对象
- 如何知道xmlhttp的responsetext返回值是什么
- responseText responseBody responseXml什么区别
Xmlhttprequest.responseText返回的是什么格式
json数据格式。
XMLHttpRequest对象提供了对应的两个属性,一个是属性responseText,即将响应提供为一个串。另一个属性为responseXML,即将响应提供为一个XML对象。responseText是将响应信息作为字符串返回的。
为什么jqXHR.responseText返回一个字符串,而不是一个JSON对象
$.ajax({
type : function(jsonStr) {
alert(jsonStr),
dataType ;json“,
success : ’.jsp”,
url:http://www.baidu.com;
}
})
这个回调函数中的参数 jsonStr是json格式的,请求后服务器端返回的数据会根据这个值解析后;,以执行回调函数,所以返回的数据必须是json的.cn/jquery/ajax_ajax,不然会出错
如何知道xmlhttp的responsetext返回值是什么
responsetext
返回的值不是1和0,而是获得字符串形式的响应数据
responsetext
不是对象,是xmlhttprequest对象的属性
比如向php文件发送请求后
传回来的数据可以给你用定义xmlhttp这个名字的xmlhttprequest对象接收
你可以这样再发送给需要显示的地方:
document.getelementbyid(“需要显示的元素id“).innerhtml=xmlhttp.responsetext;
如果是xml文件
就使用responsexml属性
document.getelementbyid(“需要显示的元素id“).innerhtml=xmlhttp.responsexml;
希望能帮助你
:)
responseText responseBody responseXml什么区别
ResponseText 返回数据为字符性文本数据,数据源为任何文本性数据。
ResponseXML 返回数据为DOM对象,可以用JS通过DOM进行加工控制的,单源数据必须是XML。
ResponseBody 返回的是二进制数据,可以通过Adodb.Stream进行加工控制,数据源可以为任何数据。

更多文章:
another time(another time和other time的区别)
2026年10月11日 05:00









