在documentation of jQuery AJAX Events所有例子使用的是jQuery的DOM元素的声明绑定这样的:jQuery的结合AJAX事件,而DOM元素
$('.log').ajaxSend(hander);
我要赶jQuery的AJAX事件而不需要有一个DOM元素附加他们,就像这样:
$.ajaxSend(function(event, jqXHR, ajaxOptions){
console.log("ajaxSend");
console.log("ajaxSend.event", event);
console.log("ajaxSend.jqXHR", jqXHR);
console.log("ajaxSend.ajaxOptions", ajaxOptions);
});
但它看起来像它不工作:
Uncaught TypeError: Object function (a,b){return new e.fn.init(a,b,h)} has no method 'ajaxSend'
有没有什么建议?
听起来像是你不”你的页面上没有jQuery。 – Jeff 2012-07-26 15:20:54
@Jeff:TypeError显示的函数是jQuery函数*(obfuscated)*。 jQuery函数也是其他函数和数据的命名空间。该错误是因为该名称空间中没有'ajaxSend'方法。 – 2012-07-26 15:21:49
@amnotiam是的,我注意到了。虽然我没有更好的答案。抱歉。 – Jeff 2012-07-26 15:24:22