0
我有一個叫做新聞的div類。它包含用戶的一些更新。當用戶提交新的更新時,我希望這個新的更新出現在新聞類的頂部,因爲它是新的。加載ajax成功的php文件
我嘗試了以下方法,但它不能按我想要的方式工作。當我提交表單,latestpost.php被載入但新聞DIV消失(因爲我的前置()是空的。)
$(document).ready(function() {
$('#new').submit(function (e) {
e.preventDefault();
var form = $(this);
var formData = form.serialize();
$.ajax({
type: 'POST',
url: '/modules/feed/process.php', // the url where we want to POST
data: formData, // our data object
success: function() {
$("#statustext").val(''); // I reset textarea's value here
$(".news").prepend().load("/modules/feed/latestpost.php"); // problematic part
}
});
});
});
您可以在process.php – brenjt