Created
August 29, 2013 03:53
-
-
Save jbouy/6374085 to your computer and use it in GitHub Desktop.
Simple jQuery Delete Link for ASP.NET MVC From http://haacked.com/archive/2009/01/30/simple-jquery-delete-link-for-asp.net-mvc.aspx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[AcceptVerbs(HttpVerbs.Post)] | |
public ActionResult Delete(int id) { | |
//Delete that stuff! | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static string DeleteAnswerLink(this HtmlHelper html, string linkText, Answer answer) | |
{ | |
return html.RouteLink(linkText, "answer", | |
new { answerId = answer.Id, action = "delete" }, | |
new { onclick="$.post(this.href); return false;" }); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<a href="/go/delete/1" onclick="$.post(this.href); return false;">Delete</a> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment