I have just started to learn jQuery and I think I am getting the hang to it, except this issue. I have a page of comments the user would like to delete. I am used to doing something like this:
$(function() {
$(".commentdeletebutton").click(function() {
$.ajax({
type: "POST",
url: "http://myflashpics.com/process_deletecomment.php",
data: $("#commentdeleteform").serialize(),
success: function() {
// Comment IDS are like this 'comment_123'
var commentId = $(comment_id).val();
var commentDone = "comment_" + commentId;
$(commentDone).fadeOut();
}
});
return false;
});
});
But since there are multiple instances of IDs, it’s not working and nothing is happening.
Again, newbie here wondering what would be a better way to do this.
Thanks
Coulton
@php ,
First thing you should not have multiple ids on the DOM , this can cause several problems while parsing.
If you want to group them , give a generic class name like
later you can extrack the ID from the class and do your logic
you can do something like this