我还有一个古灵精怪的小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;
})