日期:2014-05-16 浏览次数:20702 次
/*
 * Returns a function that waits for the specified XMLHttpRequest
 * to complete, then passes its XML response to the given handler function.
 * req - The XMLHttpRequest whose state is changing
 * responseXmlHandler - Function to pass the XML response to
*/
function getReadyStateHandler(req, responseXmlHandler) {
??// 返回一个监听XMLHttpRequest实例的匿名函数
??return function () {
????// 如果请求的状态是“完成”
????if (req.readyState == 4) {
??????// 检查是否成功接收了服务器响应
??????if (req.status == 200)