2009-10-15 97 views
1
現有的div

我目前使用下面的代碼中插入產生的內容到一個DIV:插入內容與AJAX和jQuery

$(this).next("div").load("getcontent","contentid="+id"); 

然而,目前這一由替換了DIV任何內容由getpost返回的內容。我想在下一個div的開頭插入內容。 jQuery可以嗎?

回答

2

使用prepend,e.g:

$.get('getcontent',"contentid="+id, function(html) { 
    $(this).next("div").prepend(html); 
});