jQUERY onclick post


jQUERY onclick post



I want to make a POST request to my Controller with jquery.

function Send() {    $.post("User/Delete/1"); }  <a href="#" onclick="Send()">Delete</a> 

It doesn't work, however if i write this code:

<%= Html.ActionLink("Delete", "Delete", new { onclick = "$.post('User/Delete/1')" })%> 

it works fine. Unfortunetly i cant use this phrase because i need to call that Send() method from a jQUERY UI dialog too.

Thank you


Problem with Primary Key in a Partial View shared by Create and Edit views

1:

How to start a new ASP.NET MVC site?
You missed the leading slash:. How can I determine the current controller action in an mvc sitemap?
 $.post("/User/Delete/1"); 
Check ASP.NET MVC values (roles) from client (jQuery)Building a repeatable HTTP request parameter

2:

“ASP.NET Webforms MVP” as an alternative to “ASP.NET MVC” [closed]
You may have better luck binding to the Click event using jQuery, which would require you to be able to identify your link. Asp.net Mvc Routing problem So lets say you commit it an id of postLink, then you could did any thing like:. How to dynamically determine which HTML 'wrapper' file to use based on the Action Method being executed?
$(document).ready(function() {     $("#postLink").click(function() {         $.post("User/Delete/1");     }); }); 


53 out of 100 based on 18 user ratings 43 reviews

@