JQuery的阿贾克斯脚本不工作在IE浏览器上的第二次点击,但在第二次单击在FF和Chrome工作 [英] JQuery-Ajax script not working in ie on second click but working in FF and Chrome on second click

查看:152
本文介绍了JQuery的阿贾克斯脚本不工作在IE浏览器上的第二次点击,但在第二次单击在FF和Chrome工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我还有一个古灵精怪的小jQuery的阿贾克斯问题。下面的脚本作品完美时在FF和铬多次点击,但只能在IE中的第一个点击。我已经在萤火并没有问题看它。我有一个可以重复infinately就好了类似的JQ脚本,但想不通为什么这个人会不会。

现在,我认为它的其它脚本是POST请求,仅供参考。任何想法?

下面

的jQuery AJAX脚本:

  $('活动')。在('点击','。提示',功能(五){
    即preventDefault();
    VAR提示= $(本);
    变种class_tips = tip.parent();
    VAR actID = class_tips.find('值')VAL()。
    $阿贾克斯({
        键入:GET,
        数据:captip =+ actID,
        网址:包括/ tips.php
        成功:函数(MSG){
            class_tips.find('。tips_right)HTML(MSG)。
        }
    });
    返回false;
})
 

解决方案

我觉得如果你返回true成功,应该重置 。在电子preventDefault();

  $('活动')。在('点击','。提示',功能(五){
    即preventDefault();
    VAR提示= $(本);
    变种class_tips = tip.parent();
    VAR actID = class_tips.find('值')VAL()。
    $阿贾克斯({
        键入:GET,
        数据:captip =+ actID,
        网址:包括/ tips.php
        成功:函数(MSG){
            class_tips.find('。tips_right)HTML(MSG)。
            返回true;
        }
    });
    返回false;
})
 

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;
})

解决方案

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;
})

这篇关于JQuery的阿贾克斯脚本不工作在IE浏览器上的第二次点击,但在第二次单击在FF和Chrome工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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