Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jquery-ui/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery ui jQuery UI选项卡:ajaxOption don';它不能正常工作_Jquery Ui_Jquery_Jquery Ui Tabs - Fatal编程技术网

Jquery ui jQuery UI选项卡:ajaxOption don';它不能正常工作

Jquery ui jQuery UI选项卡:ajaxOption don';它不能正常工作,jquery-ui,jquery,jquery-ui-tabs,Jquery Ui,Jquery,Jquery Ui Tabs,选项有多个选项 我有下一个代码: $('#tabs').tabs({ cookie:{expires:1}, cache:true, ajaxOptions:{ beforeSend: function(xhr,settings){ $(".ajax-gif").css("top",$(window).scrollTop()).show(); }, error: function(xhr,status

选项有多个选项

我有下一个代码:

$('#tabs').tabs({
    cookie:{expires:1},
    cache:true,
    ajaxOptions:{
        beforeSend: function(xhr,settings){
            $(".ajax-gif").css("top",$(window).scrollTop()).show();
        },
        error: function(xhr,status,index,anchor){
            $(anchor.hash).html("Couldn't load this tab.");
        },
        complete: function(xhr,textStatus){
            $(".ajax-gif").hide();
        }
    }
});
但是ajax gif没有显示

jQuery ajaxSetup(没有jqueryui)中的相同代码非常适合于普通ajax请求(不在UI选项卡中)。我哪里弄错了

谢谢

澄清

通常ajax请求使用POST表单,选项卡使用GET表单。

我找到了解决方案:

$(document).ajaxSend(function(){
    $(".ajax-gif").css("top",$(window).scrollTop()).show();
});
$(document).ajaxComplete(function(){
    $(".ajax-gif").hide();
});

您使用的是什么版本的jQuery UI选项卡?ajaxOptions选项仅在1.8版之前可用,您可以在中看到

对于当前版本(1.11),您将使用beforeLoad属性。像这样:

$('#tabs').tabs({
    beforeLoad: function (event, ui) {

        $(".ajax-gif").css("top",$(window).scrollTop()).show();

        ui.jqXHR.complete(function(data) {
            $(".ajax-gif").hide();
        });

        ui.jqXHR.error(function(data) {
            $(anchor.hash).html("Couldn't load this tab.");
        });
    }
});

ajaxOptions选项仅在jQuery Ui选项卡1.8之前可用,您可以在中看到。