面试题-JQuery里Ajax的原理是怎样的?

1、通过 new XMLHttpRequest 或其它的形式(指IE)生成ajax的对象xhr。

2、通过xhr.open(type, url, async, username, password)的形式建立一个连接。

3、通过setRequestHeader设定xhr的请求头部(request header)。

4、通过send(data)请求服务器端的数据。

5、执行在xhr上注册的onreadystatechange回调处理返回数据。

参考:http://doc.chinaunix.net/web/200901/207951.shtml