相当于ajaxSend和/或ajaxComplete与JSONP? [英] Equivalent to ajaxSend and/or ajaxComplete with jsonp?

查看:173
本文介绍了相当于ajaxSend和/或ajaxComplete与JSONP?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在,我使用的:

$("#status")
    .on("ajaxSend", function() { $(this).show(); } )
    .on("ajaxComplete", function() { $(this).hide(); } );

要获得一个状态时,AJAX是工作。这个工作使用JSON,但不与JSONP。有没有办法让这个与JSONP工作?谢谢你。

To get a status when ajax was working. This worked with json, but not with jsonp. Is there a way to get this to work with jsonp? Thank you.

推荐答案

这似乎的是一个错误的jQuery 的一个bug,或者至少考虑。

This appears to be a bug in jQuery, or at least consideration for a bug.

不幸的是,你不能在这一点上,除了在 beforeSend 完整

Unfortunately you can't do anything about it at this point except update your jsonp requests to use the same things on beforeSend and complete:

function ajaxSend() { $("#status").show(); }
function ajaxComplete() { $("#status").hide(); }

$.ajaxSend(ajaxSend);
$.ajax({
   dataType: 'jsonp',
   beforeSend: ajaxSend,
   complete: ajaxComplete
});

这篇关于相当于ajaxSend和/或ajaxComplete与JSONP?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆