PageSourceSearch

http://passport.9wee.com/common/script/ajax.js

js 9wee.com collected 2026-10-04 16:21:00 UTC 2,455 bytes, 104 lines download raw bytes

1/*
2Ajax ç±»
3sUrl : 目标 URL
4sQueryString : 提交变量
5callbackFunc : 回调函数
6callbackParams : 回调函数参数
7sRecvType : 返回值格式 ( 0: 文本, 1: XML );
8*/
9
10function Ajax ( sUrl, sQueryString, callbackFunc, callbackParams, sRecvType )
11{
12	this.Url = sUrl;
13	this.QueryString = sQueryString != null ? sQueryString : '';
14	this.response; // 返回值
15
16	this.XmlHttp = this.createXMLHttpRequest ();
17	if ( this.XmlHttp == null )
18	{
19		alert ( "网络连接出错, 请重试!" );
20		return;
21	}
22	var objxml = this.XmlHttp;
23	objxml.onreadystatechange = function ()
24	{
25		Ajax.handleStateChange ( objxml, sRecvType, callbackFunc, callbackParams )
26	}
27}
28
29Ajax.prototype.createXMLHttpRequest = function ()
30{
31	try
32	{
33		return new ActiveXObject ( "Msxml2.XMLHTTP" );
34	}catch(e) {}
35
36	try
37	{
38		return new ActiveXObject ( "Microsoft.XMLHTTP" );
39	} catch(e) {}
40
41	try
42	{
43		return new XMLHttpRequest ();
44	} catch(e) {}
45
46	return null;
47}
48
49Ajax.prototype.createQueryString = function ()
50{
51	var queryString = '';
52	if ( this.QueryString != null && typeof ( this.QueryString ) != 'string' )
53	{
54		var elements = this.QueryString.elements;
55		var pairs = new Array();
56		for(var i=0;i<elements.length;i++){
57			if((name=elements[i].name)&&(value = elements[i].value)){
58				pairs.push(name + "=" + encodeURIComponent(value));
59			}
60		}
61		queryString = pairs.join ("&");
62	}
63	else
64	{
65		queryString = this.QueryString;
66	}
67	return queryString;
68}
69
70Ajax.prototype.get = function ()
71{
72	sUrl = this.Url;
73	var queryString = sUrl + ( sUrl.indexOf ('?') > 0 ? '&' : '?' ) + this.createQueryString();
74	this.XmlHttp.open ( "GET", queryString, true );
75	this.XmlHttp.send ( null );
76}
77
78Ajax.prototype.post = function ()
79{
80	var sUrl = this.Url;
81	var queryString = this.createQueryString ();
82	this.XmlHttp.open ( "POST", sUrl, true );
83	this.XmlHttp.setRequestHeader ( "Content-Type","application/x-www-form-urlencoded" );
84	this.XmlHttp.send ( queryString );
85}
86
87Ajax.handleStateChange = function ( XmlHttp, sRecvType, callbackFunc, callbackParams )
88{
89	if ( XmlHttp.readyState == 4 )
90	{
91		if ( XmlHttp.status == 200  )
92		{
93			Response = sRecvType ? XmlHttp.responseXML : XmlHttp.responseText;
94			if ( callbackFunc != null )
95			{
96				callbackFunc ( Response, callbackParams );
97			}
98		}
99		else
100		{
101			// alert ( "您还没有登陆或者登陆已经超时, 请登陆后重试!" );
102		}
103	}
104} 

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.