Donate

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:
1
2
3
4
5
function GetProductData(event) {
    $.getJSON('@Url.Action("GetProductDetails","Product")', function (prod) {
        alert(prod);
    });
}

Comments

Donate

Popular Posts From This Blog

WPF CRUD Application Using DataGrid, MVVM Pattern, Entity Framework, And C#.NET

How To Insert Or Add Emojis In Microsoft Teams Status Message

Pass GUID As Parameter To Action Using ASP.NET MVC ContribGrid