JQuery-Ajax脚本无法工作,即第二次点击,但在第二次点击时在FF和Chrome中工作

时间:2022-12-01 09:13:18

I have another weird little jquery-ajax problem. The script below works perfectly upon multiple clicks in FF and chrome, but only works the first click in ie. I have viewed it in firebug and no problems. I have similar jq scripts that can repeat infinately just fine, but can't figure out why this one won't.

我有另一个奇怪的小jquery-ajax问题。下面的脚本完全适用于FF和chrome中的多次单击,但只能在第一次点击时工作。我在萤火虫中看过它并没有问题。我有类似的jq脚本可以无限重复,但无法弄清楚为什么这个不会。

Now that I think of it the other scripts are POST requests, FYI. ANY IDEAS?

现在,我想到了其他脚本是POST请求,仅供参考。有任何想法吗?

JQuery-AJAX script below:

下面的JQuery-AJAX脚本:

$('.activity').on('click', '.tip', function(e){
    e.preventDefault();
    var tip = $(this);
    var class_tips = tip.parent();
    var actID = class_tips.find('.value').val();
    $.ajax({
        type: "GET",
        data: "captip=" + actID,
        url: "includes/tips.php",
        success: function(msg){
            class_tips.find('.tips_right').html(msg);
        }
    });
    return false;
})

1 个解决方案

#1


0  

I think if you return true on success it should reset the e.preventDefault();

我想如果你在成功时返回true,它应该重置e.preventDefault();

$('.activity').on('click', '.tip', function(e){
    e.preventDefault();
    var tip = $(this);
    var class_tips = tip.parent();
    var actID = class_tips.find('.value').val();
    $.ajax({
        type: "GET",
        data: "captip=" + actID,
        url: "includes/tips.php",
        success: function(msg){
            class_tips.find('.tips_right').html(msg);
            return true;
        }
    });
    return false;
})

#1


0  

I think if you return true on success it should reset the e.preventDefault();

我想如果你在成功时返回true,它应该重置e.preventDefault();

$('.activity').on('click', '.tip', function(e){
    e.preventDefault();
    var tip = $(this);
    var class_tips = tip.parent();
    var actID = class_tips.find('.value').val();
    $.ajax({
        type: "GET",
        data: "captip=" + actID,
        url: "includes/tips.php",
        success: function(msg){
            class_tips.find('.tips_right').html(msg);
            return true;
        }
    });
    return false;
})