这种写法怎么报错!
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"); } } }();
前台调用:
<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>
报错:
TypeError: $.ajaxSetting is not a function
求解?