我刪除了var string
和$.ajax data:
行,但我的腳本仍然正常工作,那麼這是爲什麼呢?
$(function() {
$(".delete").click(function() {
$('#load').fadeIn();
var commentContainer = $(this).parent();
var id = $(this).attr("id");
var string = 'id='+ id ;
$.ajax({
type: "POST",
url: "delete.php",
data: string,
cache: false,
success: function(){
commentContainer.slideUp('slow', function() {$(this).remove();});
$('#load').fadeOut();
}
});
return false;
});
});
我們如何能夠知道它是什麼?它是你的代碼... – PeeHaa
你應該首先閱讀[jQuery API](http://api.jquery.com/)。 –