jquery queue ajax,GitHub - gnarf/jquery-ajaxQueue: A simple queue for your ajax requests in jQuery.

jQuery AjaxQueue 是一个插件,确保同一时间只有一个 AJAX 请求在运行。它通过 jQuery 的内置队列等待前一个请求完成后再开始新的请求。该插件接受与 jQuery.ajax 相同的选项,并返回一个行为类似 jqXHR 的承诺对象。你可以使用 abort() 方法来取消队列中的请求。此外,该项目遵循 MIT 许可,并提供 Grunt 进行测试和构建。
摘要由CSDN通过智能技术生成

jQuery Ajax Queue

Which files to use?

The release version of the code is found in the dist/ directory.

In your web page:

jQuery.ajaxQueue({

url: "/ajax",

dataType: "json"

}).done(function( data ) {

// ...

});

Documentation

This pluging creates a new method which ensures only one AJAX request is running at a time. It waits for the previous request(s) to finish before starting a new one using jQuery's built in queue.

jQuery.ajaxQueue( options )

Takes the same options as jQuery.ajax, and returns a promise. The return value is not a jqXHR, but it will behave like one. The abort() method on the returned object will remove the request from the queue if it has not begun, or pass it along to the jqXHR's abort method once the request begins.

Examples

(Coming soon)

Release History

v0.1.1 - 2013-01-16

Changed keywords in package file

v0.1.0 - 2013-01-16

License

Copyright (c) 2013 Corey Frang

Licensed under the MIT license.

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using grunt.

Important notes

Please don't edit files in the dist subdirectory as they are generated via grunt. You'll find source code in the src subdirectory!

While grunt can run the included unit tests via PhantomJS, this shouldn't be considered a substitute for the real thing. Please be sure to test the test/*.html unit test file(s) in actual browsers.

Installing grunt

This assumes you have node.js and npm installed already.

Test that grunt is installed globally by running grunt --version at the command-line.

If grunt isn't installed globally, run npm install -g grunt to install the latest version. You may need to run sudo npm install -g grunt.

From the root directory of this project, run npm install to install the project's dependencies.

Installing PhantomJS

In order for the qunit task to work properly, PhantomJS must be installed and in the system PATH (if you can run "phantomjs" at the command line, this task should work).

Unfortunately, PhantomJS cannot be installed automatically via npm or grunt, so you need to install it yourself. There are a number of ways to install PhantomJS.

Note that the phantomjs executable needs to be in the system PATH for grunt to see it.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值