含义模式:'中止'在JS Ajax请求中

meaning mode: 'abort' in JS Ajax request

本文关键字:JS Ajax 请求 中止 模式      更新时间:2023-09-26

我不确定是否理解JQ Ajax请求中'abort'选项的用途
它是用来做什么的?

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

它不包含在jQuery的核心中,它附带了一个名为ajaxQueue的插件。模式:中止,中止所有当前ajax请求,可选您可以使用端口来限制要中止的组。jQuery自动完成插件的代码示例:

$.ajax({
    // try to leverage ajaxQueue plugin to abort previous requests
    mode: "abort",
    // limit abortion to this input
    port: "autocomplete" + input.name,
    ....