| 注册
请输入搜索内容

热门搜索

Java Linux MySQL PHP JavaScript Hibernate jQuery Nginx
byb1234
10年前发布

轻量级的 AJAX 客户端:jsonpipe

jsonpipe 是一个轻量级的 AJAX 客户端,用于处理压缩(chunked)的 JSON 响应信息。

示例代码:

var jsonpipe = require('jsonpipe');  /**   * @param {String} url A string containing the URL to which the request is sent.   * @param {Object} url A set of key/value pairs that configure the Ajax request.   * @return {XMLHttpRequest} The XMLHttpRequest object for this request.   * @method flow   */  jsonpipe.flow('http://api.com/items?q=batman', {      "delimiter": "", // String. The delimiter separating valid JSON objects; default is "\n\n"      "success": function(data) {          // Do something with this JSON chunk      },      "error": function(errorMsg) {          // Something wrong happened, check the error message      },      "complete": function(statusText) {          // Called after success/error, with the XHR status text      },      "timeout": 3000, // Number. Set a timeout (in milliseconds) for the request      "method": "GET", // String. The type of request to make (e.g. "POST", "GET", "PUT"); default is "GET"      "headers": { // Object. An object of additional header key/value pairs to send along with request          "X-Requested-With": "XMLHttpRequest"      },      "data": "" // String. A serialized string to be sent in a POST/PUT request  });

项目主页:http://www.open-open.com/lib/view/home/1429107222705

 本文由用户 byb1234 自行上传分享,仅供网友学习交流。所有权归原作者,若您的权利被侵害,请联系管理员。
 转载本站原创文章,请注明出处,并保留原始链接、图片水印。
 本站是一个以用户分享为主的开源技术平台,欢迎各类分享!
 本文地址:https://www.open-open.com/lib/view/open1429107222705.html
jsonpipe Ajax框架