1

I am not sure I understand the purpose of the 'abort' option in JQ Ajax requests.
What is it used for?

$.ajax({
                **mode: 'abort',**

                dataType: 'html',
                url: baseUrl + '/books/search/isbn/' + value + '/current_status/dropped',
                success: function(data) {
                    $('#found-books').html(data);
                }
        });
4

1 回答 1

2

它不包含在jQuery的核心中,它带有一个名为ajaxQueue的插件。mode:abort,中止所有当前的ajax请求,可选的你可以使用一个端口来限制你正在中止的组。带有jQ​​uery 自动完成插件的代码示例:

$.ajax({
    // try to leverage ajaxQueue plugin to abort previous requests
    mode: "abort",
    // limit abortion to this input
    port: "autocomplete" + input.name,
    ....
于 2013-04-11T15:16:01.617 回答