I have a list of posts uploaded to my page using ajax:
var fm = <?php echo $from_user ;?>;
$("#microblogposts").load("posts.php", {from_user: fm}, function(){
});
In this message list, I have a function to remove messages from the list:
$("form#deletepost").submit(function() {
var deleteid = $('#deleteid').attr('value');
$.ajax({
type : "POST",
url: "process.php",
data: {deleteid : deleteid},
error: function(){
alert("Mesage could not be posted at this time. Please try again.");
},
success: function(){
$("#microblogposts").load("posts.php", {from_user: fm}, function(){
});
$("#latestpost").load("latestpost.php", {from_user: fm}, function(){
});
}
});
return false;
});
I want the code to update some elements in the DOM when AJAX was successful, but it does not work, it can still be done.
source
share