Dzwebs.Net

撰写电脑技术杂文十余年

XmlHttp之Send参数示例介绍

Admin | 2012-6-15 10:40:51 | 被阅次数 | 11536

温馨提示!

如果未能解决您的问题,请点击搜索;登陆可复制文章,点击登陆

  send功能:发送请求到http服务器并接收回应

  语法

  oXMLHttpRequest.send(varBody);

  参数介绍

  varBody 欲通过此请求发送的数据。

  举例如下:

  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP.3.0");
  xmlhttp.open("GET", "http://localhost/dzwebs.xml", false);
  xmlhttp.send();
  alert(xmlhttp.responseXML.xml);

  注意:此方法的同步或异步方式取决于open方法中的bAsync参数,如果bAsync == False,此方法将会等待请求完成或者超时时才会返回,如果bAsync == True,此方法将立即返回。

  This method takes one optional parameter, which is the requestBody to use. The acceptable VARIANT input types are BSTR, SAFEARRAY of UI1 (unsigned bytes), IDispatch to an XML Document Object Model (DOM) object, and IStream *. You can use only chunked encoding (for sending) when sending IStream * input types. The component automatically sets the Content-Length header for all but IStream * input types.

  如果发送的数据为BSTR,则回应被编码为utf-8, 必须在适当位置设置一个包含charset的文档类型头。

  If the input type is a SAFEARRAY of UI1, the response is sent as is without additional encoding. The caller must set a Content-Type header with the appropriate content type.

  如果发送的数据为XML DOM object,则回应将被编码为在xml文档中声明的编码,如果在xml文档中没有声明编码,则使用默认的UTF-8。

  If the input type is an IStream *, the response is sent as is without additional encoding. The caller must set a Content-Type header with the appropriate content type.


该杂文来自: 网页制作杂文

上一篇:responseBody、responseStream、responseText和re

下一篇:XmlHttp之status返回值及简单例子

网站备案号:

网站备案号:滇ICP备11001339号-7

版权属性:

Copyright 2007-2021-forever Inc. all Rights Reserved.

联系方式:

Email:dzwebs@126.com QQ:83539231 访问统计