jQuery的ajaxComplete:有没有办法知道哪些Javascript函数执行Ajax调用?没有办法、函数、ajaxComplete、jQuery

由网友(有学霸的心却没学渣的命)分享简介:我有.ajaxComplete事件接线像这几个元素:I have the .ajaxComplete event wired up to a few elements like this:$(#ElementId)ajaxComplete(功能(A,B,C){}); 问题是,我有多个 $。阿贾克斯在我的剧本是由各...

我有.ajaxComplete事件接线像这几个元素:

I have the .ajaxComplete event wired up to a few elements like this:

$(#ElementId)ajaxComplete(功能(A,B,C){});

问题是,我有多个 $。阿贾克斯在我的剧本是由各种功能被称为呼叫。我不希望.ajaxComplete事件触发的每一个控制每一个Ajax调用。从概念上讲,我期待这样的事情:

The issue is that I have multiple $.ajax calls in my script that are called by various functions. I don't want the .ajaxComplete event to fire for every control for every ajax call. Conceptually, I am looking for something like this:

如果(a.function == SearchCustomers){做到这一点}

有没有什么办法可以达到我想要的吗?

Is there any way to achieve what I want here?

编辑:我知道我可以检查我打电话了服务的URL,但我不希望在我的脚本不止一次硬codeA的URL字符串

I realize that I can check for the URL of the service I am calling, but I don't want to hardcode a URL string in my scripts more than once.

推荐答案

您需要做的是这样的:

$.ajax({
    url: "servicecall.html",
    success: function(html){
        //if success
    };
});
阅读全文

相关推荐

最新文章