1
嘿,任何人,即時通訊在這裏遇到一些麻煩。jQuery Post成功
當span被點擊時,它會向php發送一些數據,從我的MySQL中刪除一些東西。好! 這很好。加工。
但是,當我嘗試設置爲jquery隱藏或淡出一個元素對我來說,在發佈行動內,他並沒有隱藏它。
但是,當我把它設置爲POST動作,它的工作原理。爲什麼?
$('.deletar span').click(function() {
//alert($(this).attr('id'));
var id = $(this).attr('id');
$(this).parent().parent().find('.carregando').show();
$(this).parent().parent().fadeOut();
/*$.post('deletar.php',{id: id}, function(data){
//$(this).parent().parent().find('.carregando').hide();
//$.parent().parent().parent().text('haha');
alert($(this).parent().parent().find('.carregando'));
$(this).parent().parent().find('.carregando').fadeOut();
});*/
});
謝謝!
你確定POST成功嗎?這聽起來好像不是......更好地觀察Firebug /你選擇的工具,看看會發生什麼。 – 2010-12-13 18:47:27
可能是post函數不能像click或mouseover那樣對待(我從來沒有用它作爲事件函數) – SmootQ 2010-12-13 18:52:23
在POST的回調中,'$(this)'不是單擊的元素。您需要保存對「$(this)」的引用。 – 2010-12-13 20:27:33