JQuery-Ajax script not working in ie on second click but working in FF and Chrome on second click

烂漫一生 提交于 2019-12-24 11:29:23

问题


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.

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

JQuery-AJAX script below:

$('.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:


I think if you return true on success it should reset the 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;
})


来源:https://stackoverflow.com/questions/14869308/jquery-ajax-script-not-working-in-ie-on-second-click-but-working-in-ff-and-chrom

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!