$(".itemInto").click(function(){
var a = $(this).siblings(".itemName").html();
$.ajax({
type: "POST",
dataType: "json",
url: "process.php",
data: {a:a},
success: function(data) {
alert (data); // 20
$(this).siblings(".itemCount").text(data); // doesn't work. Nothing happens.
}
});
});
.itemCount
是.itemInto
的同胞。爲什麼我不能在裏面放置data
?控制檯是免費的。
TJ,這是行不通的。我複製了你的代碼。 – bonaca 2014-09-28 13:09:41
@bonaca它究竟如何運作?不會有任何參考問題。選中此[小提琴](http://jsfiddle.net/xmr6soum/)。無論如何,請檢查[更新](http://jsfiddle.net/xmr6soum/1/)。 – 2014-09-28 13:16:45