我是jQuery的初學者,我正致力於修復我在我的網站上看到的錯誤。如果您選中/取消選中購物車中的複選框,我會執行ajax調用。 所以,如果我取消選中我的購物車中的東西,它會自動保存。這在FF中工作,但不在Chrome或IE中。有什麼建議可能是什麼問題?jQuery的功能不適用於Chrome和IE 8
function toggleDisplay(id,boutiqueid){
obj = $('#'+id);
chk = obj.find('input[name='+id+']');
if(chk.is(':checked')){
$.ajax({
url:'MyRecentPurchaseProcess.jsp?action=add&boutiqueId='+boutiqueid+'&shipment='+id,
success: function(data) {
eval(data);
if(outcome.result=='true'){
obj = $('#'+id);
obj.find('.blanket_fold').attr('class','blanket_unfold')
obj.find('.prod').attr('class','prod_under');
}
}
});
} // inserted by editor
else{
$.ajax({
url:'MyRecentPurchaseProcess.jsp?action=delete&boutiqueId='+boutiqueid+'&shipment='+id,
success: function(data) {
eval(data);
if(funcResult.result == 'true'){
obj = $('#'+id);
obj.find('.blanket_unfold').attr('class','blanket_fold')
obj.find('.prod_under').attr('class','prod');
chk = obj.find('input[name='+id+']');
chk.attr('checked',false);
}
}
});
} // inserted by editor
} // inserted by editor
你能發佈你的代碼嗎?如果您展示迄今爲止所獲得的成果,那麼您將有更好的機會獲得解決方案。 – Town
請向我們顯示您的代碼。沒有代碼,我唯一的猜測是你的事件監聽器設置是錯誤的(onchange/onchecked/onclick?) –
function toggleDisplay(id,boutiqueid){ \t \t \t obj = $('#'+ id); \t \t \t chk = obj.find('input [name ='+ id +']'); \t \t \t如果(chk.is( ':檢查')){ \t \t \t \t $阿賈克斯({ \t \t網址: '?MyRecentPurchaseProcess.jsp行動=添加&boutiqueId =' + boutiqueid + '&出貨=' + ID , \t \t \t成功:功能(數據){ \t \t \t \t \t \t \t的eval(數據); \t \t \t \t \t \t \t如果(outcome.result == '真'){ \t \t \t \t \t \t \t \t OBJ = $( '#' + ID); \t \t \t \t \t \t \t \t obj.find( 'blanket_fold ')。ATTR(' 類, 'blanket_unfold') \t \t \t \t \t \t \t \t obj.find('。PROD')。ATTR( '類', 'prod_under'); \t \t \t \t \t \t \t} \t \t \t \t \t} \t \t \t \t \t}); – uppaljaskaran