- 浏览: 54693 次
- 性别:
- 来自: 广州
最新评论
-
Joson_Coney:
11.
while( (*strDest++ = *strSr ...
c++笔试题汇总 -
Joson_Coney:
③ 1.
int func(x)
{
int countx = ...
c++笔试题汇总 -
Joson_Coney:
链表反向1:
#include <cstdlib&g ...
c++笔试题汇总
HTTP Request
- 博客分类:
- web开发
HTTP Request
Published in: JavaScript
Generic global code for managing XMLHttpRequest objects.
Expand | Embed | Plain Text
-
// ----------------------------------------
-
// Wrapper function for constructing a request object.
-
// Parameters:
-
// reqType: The HTTP request type, such as GET or POST.
-
// url: The URL of the server program.
-
// asynch: Whether to send the request asynchronously or not.
-
// ----------------------------------------
-
-
function httpRequest(reqType,url,asynch) {
-
-
// Mozilla-based browsers
-
if (window.XMLHttpRequest) {
-
request = new XMLHttpRequest();
-
} else if (window.ActiveXObject) {
-
request = new ActiveXObject("Msxml2.XMLHTTP");
-
if (!request) {
-
request = new ActiveXObject("Microsoft.XMLHTTP");
-
}
-
}
-
-
// Request could still be null if neither ActiveXObject
-
// initialization succeeded
-
if (request) {
-
// If the reqType param is POST, then the fifth arg is the POSTed data
-
if (reqType.toLowerCase() != "post") {
-
initReq(reqType, url, asynch, respHandle);
-
} else {
-
// The POSTed data
-
var args = arguments[4];
-
if (args != null && args.length > 0) {
-
initReq(reqType, url, asynch, respHandle, args);
-
}
-
}
-
} else {
-
alert("Your browser does not permit the use of all " +
-
"of this application's features!");
-
}
-
-
}
-
-
// ----------------------------------------
-
// Initialize a request object that is already constructed
-
// ----------------------------------------
-
-
function initReq(reqType, url, bool, respHandle) {
-
try {
-
// Specify the function that will handle the HTTP response
-
request.onreadystatechange = handleResponse;
-
request.open(reqType, url, bool);
-
// If the reqType param is POST, then the
-
// fifth argument to the function is the POSTed data
-
if (reqType.toLowerCase() == "post") {
-
// Set the Content-Type header for a POST request
-
request.setRequestHeader("Content-Type", "application/x-ww-form-urlencoded; charset=UTF-8");
-
request.send(arguments[4]);
-
} else {
-
request.send(null);
-
}
-
} catch (errv) {
-
alert("The application cannot contact the server at the moment. " +
-
"Please try again in a few seconds.\n" +
-
"Error detail: " errv.message);
-
}
-
}
发表评论
-
【转】DNS协议报文(RFC1035)
2012-01-27 06:46 1296(转自:http://hi.baidu. ... -
【转】Protocol Header Images
2012-01-27 06:45 603http://www.troyjessup.com/heade ... -
【转】DNS协议及应用
2012-01-27 06:44 871(转自http://jwx.zgz.cn/cl/7 ... -
DNS 伺服器
2012-01-26 06:03 501DNS 伺服器http://linux.vbird.org/l ... -
HTTP multipart/form-data 上传方式说明
2012-01-26 06:01 826( From: http://home.meegoq.c ... -
Struts2源码分析--请求处理
2011-12-01 10:03 607(转自:http://www.blogjava.ne ... -
java web学习笔记
2011-11-21 09:50 545Tomcat Configuration 资 ... -
[转] HTTP multipart/form-data 上传方式说明
2011-10-15 06:08 1263( From: http://home.meegoq.co ... -
Multipart uploading spec
2011-10-15 06:07 638Upload File: abc.txtContent:abc ... -
【转】Webcam Manipulation with Javascript
2011-10-15 06:04 757( From:http://blog.trumpton.org ... -
Table单元格td的position:relative的兼容性
2011-10-11 12:35 1874( From: http://www.itref.cn/a/ ... -
a lib: jXHR (JSON-P XHR)
2011-10-11 12:18 651http://mulletxhr.com/ -
Remote JSON - JSONP
2011-10-11 12:16 669( From : http://bob.pythonmac.o ... -
cross-domain资源
2011-10-07 01:32 549发现一个网站,没来得及细看,留个网址:http://www.c ... -
Single Sign-On
2011-10-07 01:25 571Single Sign-On Single sign-on ... -
HTTP multipart/form-data 上传方式说明
2011-10-07 01:23 764HTTP multipart/form-data 上传方式 ... -
【转】HTTP协议报文格式
2011-10-07 01:21 662(From: http://book.51cto.com/ar ... -
Relying on DOM readiness to invoke a function (instead of window.onload)
2011-10-06 06:45 578( From: http://www.javascriptki ... -
【转】Calling Cross Domain Web Services in AJAX
2011-10-06 06:41 719(From: http://www.simple-talk ... -
Which browsers support HTML5, CSS3, Data URLs, etc.
2011-10-06 06:38 612http://caniuse.com/#
相关推荐
HTTP Request EditorHTTP Request Editor是一款免费的HTTP抓包编辑器。。 其作用:HTTP抓包,顺便编辑一下抓到的包。。明白了?
IBM Rational HTTP Request Editor,解压后可直接使用
SendHTTPRequest 我需要的东西
一个好用的HTTP REQUEST 调试工具 http request
oracle 范文http request接口获取XML,创建表并把样例结果入库 <?xml version="1.0" encoding="utf-8"?> <linked-hash-map> <string>name 字段名称 <string>alias 中文备注 ...
SendHTTPRequest 我需要的代码
Using it, you can easily create an asynchronous HTTP request and receive event callback. It can be applied to MFC and ATL projects. This code mainly consists of two classes: class FCHttpRequest and ...
Apache JMeter是Apache组织开发的基于Java的压力测试工具。用于对软件做压力测试,它最初被设计用于Web应用测试,但后来扩展到其他测试领域。
在使用Jenkins时经常需要通过http请求去操作service API。其中HTTP Request Plugin插件就可以满足。
C# how to send http request
Node-RED用http request实现收发
Single-header C++ HTTP request class
java http request 解析 get post
HTTP Request for JAVA DEVE
主要介绍了Nginx出现The plain HTTP request was sent to HTTPS port问题解决方法,需要的朋友可以参考下
2020-02-19 10:34:46.901 INFO 5920 --- [nio-8080-exec-1] o.apache.coyote.http11.Http11Processor : Error parsing HTTP request header Note: further occurrences of HTTP header parsing errors will be ...
当使用php5自带的file_get_contents方法来获取远程文件的时候,有时候会出现file_get_contents(): failed to open stream: HTTP request failed!这个警告信息。