惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

www.infosecurity-magazine.com
www.infosecurity-magazine.com
Security Archives - TechRepublic
Security Archives - TechRepublic
TaoSecurity Blog
TaoSecurity Blog
Cloudbric
Cloudbric
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
N
News and Events Feed by Topic
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
S
Securelist
The Cloudflare Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
D
DataBreaches.Net
S
Schneier on Security
L
LangChain Blog
Jina AI
Jina AI
M
MIT News - Artificial intelligence
Recent Announcements
Recent Announcements
T
Tenable Blog
B
Blog RSS Feed
V
Visual Studio Blog
Simon Willison's Weblog
Simon Willison's Weblog
G
Google Developers Blog
T
The Exploit Database - CXSecurity.com
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
WordPress大学
WordPress大学
W
WeLiveSecurity
I
InfoQ
The Hacker News
The Hacker News
雷峰网
雷峰网
月光博客
月光博客
P
Privacy & Cybersecurity Law Blog
O
OpenAI News
Hacker News: Ask HN
Hacker News: Ask HN
T
Threat Research - Cisco Blogs
GbyAI
GbyAI
The Last Watchdog
The Last Watchdog
P
Privacy International News Feed
Cyberwarzone
Cyberwarzone
S
SegmentFault 最新的问题
L
Lohrmann on Cybersecurity
人人都是产品经理
人人都是产品经理
V
V2EX
V
Vulnerabilities – Threatpost
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
C
Cybersecurity and Infrastructure Security Agency CISA
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
T
Troy Hunt's Blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
阮一峰的网络日志
阮一峰的网络日志
SecWiki News
SecWiki News
Microsoft Azure Blog
Microsoft Azure Blog

博客园 - 强悍的抽屉

基于 Dapper 的一个 DbUtils WebAPI 操作返回 c#版 mqtt 3.1.1 client 实现 mqtt 协议之 PINGREQ, PINGRESP httpWebRequest 文件下载 一个 go 文件服务器 ssdb MongoDB 刷新几次就报错 C# Win32API - 强悍的抽屉 - 博客园 回车跳转控件焦点 让程序只启动一次 -- Mutex C# 排序 WINDEF.h 变量类型 SqlHelper 数据库操作类2 SqlHelper 数据库操作类 第一个 Windows 应用程序 JavaScript 字符串处理函数 - 强悍的抽屉 - 博客园 JavaScript 字符串函数扩充 - 强悍的抽屉 - 博客园 C# 字符串处理一些方法 几种流行的JS框架的选择
希望找人一起写个 Ajax 的封装
强悍的抽屉 · 2008-08-10 · via 博客园 - 强悍的抽屉

我已经写好了一些

xmlHttp.js
/**
* @version 1.0
* @时间  2008-06-26
* @作者  林松斌
* @QQ    410728115
* @Email linsongbin@126.com
* @博客 http://linsongbin.cnblogs.com/
*/
Ajax = function() {
this._url = null;
this._method = 'GET';
this._xmlhttp = null;
this.createXMLRequest();
}
Ajax.prototype.setUrl = function(url) {
    this._url = url;
}
Ajax.prototype.setMethod = function(method) {
    this._method = method;
}
  
Ajax.prototype.createXMLRequest = function() {
    try {
        this._xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (ex1) {
        try {
            this._xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        } catch (ex2) {
            this._xmlhttp = null;
        }
    }
if (!this._xmlhttp) {
  if (typeof XMLHttpRequest != "undefined") {
   this._xmlhttp = new XMLHttpRequest();
  }
}
}

Ajax.prototype.send = function(url, method, data) {
    this._url = url;
    this._methdo = method;
    var self = this;
    if (this._method.toLowerCase() == "get") {
        this._xmlhttp.open("GET", this._url, true);
        this._xmlhttp.send(null);
    } else if(this._method.toLowerCase() == "post") {
        this._xmlhttp.open("POST", this._url, true);
        this._xmlhttp.setRequestHeader('Content-Type', 'application/ x-www-form-ur lencoded');
        this._xmlhttp.send(data);
    }
this._xmlhttp.onreadystatechange = function(){self.process.call(self)};  
}
//这里需要从写
Ajax.prototype.process = function() {
switch (this._xmlhttp.readyState) {
  case 1:
   //this.onLoading();
   break;
  case 2:
   //this.onLoaded();
   break;
  case 3:
   //this.onInteractive();
   break;
  case 4:
      alert(this._xmlhttp.responseText);
}
}
/**
* 提供简易操作接口
*/
sendGET = function(url) {
    var ajax = new Ajax();
    ajax.send(url, 'post', null);
}

接着就要对 callback 函数进行重构
时刻记着: 安全, 性能, 易用 !!
如果有兴趣请与我联系!!