首页 > zepto 错误

zepto 错误

index.html

<script src="//cdn.staticfile.org/zepto/1.1.4/zepto.min.js"></script>
<script src="./assets/js/script.js"></script>
<script>
    $(function(){
        hsh.home();
        hsh.init();
    });
</script>

script.js

var hsh = (function($){

    return {

        init: function(){

            //ajax 默认设置
            $.ajaxSetting({

                type: "post",
                url: apiUrl,
                dataType : "json",
                async: true,
                error: function(xhr, errorType, error){

                },
                beforeSend: function(xhr, setting){

                },
                success: function(data, status, xhr){

                },
                complete: function(xhr, status){

                }
            });

            alert("init");
            //init.End
        },

        home: function(){

            alert("home");
        }
    }

})(Zepto);

FireBug 报错

TypeError: $.ajaxSetting is not a function

alert("init"); 也没执行!

不知道 这种方式的 zepto 应该怎么写! 求大神指教! -_-|||


看Doc: http://zeptojs.com/#$.ajaxSettings

ajaxSettings而不是ajaxSetting

【热门文章】
【热门文章】