Set Url Parameter Of $.getJSON() Method Using @Url.Action() In ASP.NET MVC
Here's how you set the first parameter of $.getJSON() which is url using @Url.Action() where GetProductDetails is the action name and Product is the controller name. Make sure to surround it with single quotes.
Javascript Code:
Javascript Code:
1 2 3 4 5 | function GetProductData(event) { $.getJSON('@Url.Action("GetProductDetails","Product")', function (prod) { alert(prod); }); } |
Comments
Post a Comment