jquery - how to deal with delete buttons in php? -


i want know best way handle delete or edit buttons?

so let's comment box, should use post or method , make validations in page suppose delete comment?

as specific example, i'm gonna point out facebook's comment box, has little button deleting comments, doesn't display url in bottom of browser, guess uses post method jquery in it. i'm right? if not should use type of buttons?

i don't know facebook uses, yes, should use post. might want use this:

<div class="comment">     <p><code>post</code> should used actions change data.</p>     <form action="comments/1/delete" method="post" class="delete-form">         <input type="submit" value="delete" />     </form> </div> 
$(".delete-form").submit(function() {     var me=$(this);     $.ajax({         type: 'post',         url: me.attr('action'),         success: function() {             me.parent().remove();         },         error: function() {             alert("oops! error occurred while deleting comment.");         }     });     return false; }); 

if don't delete button on separate line, style bit css:

.comment > p, .comment > .delete-form {     display: inline; } 

Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -