Hi,
$.ajax({ type: "Post", url: "/Home/CalledMethod", data: data, success: function (result) { alert("Success!.."); } });
url: "/Home/CalledMethod", instead of this how can I use @url.action in jQuery ajax call inside javascript file
Thanks
R
Refer below links.
https://stackoverflow.com/questions/13640559/asp-net-mvc-url-action-in-external-js-file
https://forums.asp.net/t/1988989.aspx?Jquery+url+action+in+external+js+file+how+to+resolve
But how to call a controller method from ajax Query for example if my URL is url: "/Home/CalledMethod"
Home => Controller name
Index => View name
CalledMethod => methos name in controller
what is the syntax in @url.Action @Url.Action("Index", "Home") here where to include my method "CalledMethod"?
Replace Index with CalledMethod.
@Url.Action("CalledMethod", "Home")
© COPYRIGHT 2025 ASPSnippets.com ALL RIGHTS RESERVED.