$('#find').click(function () {
$(document).ajaxStart(function () {
console.log("!!!!!!!!!!!!!!!1")
})
$(document).ajaxStop(function () {
console.log("!222222!!1")
})
$.getJSON("1.php",function (msg) {
})
})
为什么没有在console 输出任何字符呢?
还有ajax的绑定,这是什么意思呢?我点击我的按钮,然后我就发送ajax请求了,之后回调函数获得数据,这个绑定是干嘛的?
不好意思,没注意。。。我从webstorm里复制前面一段过来。
后面懒得复制了,就自己打上去,没注意。。。
还是没有任何输出呀?
$.getJSON("http://v.juhe.cn/weather/index?callback=?",function (msg) {
})
如果我请求一个api的话,就不能ajaxStart就不起作用了.
请求本地文件是起作用的,这个是为什么呢?
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
你写的是
我觉得应该是
你看看有什么不同。。是不是发现少了一个右括号
.ajaxstart()是在发送ajax请求之前执行的方法,.ajaxstop()当然就是在请求完成后执行的方法
getJson后面少个括号。。。