Topic:   Pass the dynamic form value to API in C# DotNet core
Apr 19, 2021 11:27 1 Replies 714 Views TEJA

dynamic form value, API in C# DotNet core, ASP.NET CORE,

Prev Next
Topic Replies (1)
  1. 1
    idnkx user

    KRISHNA SWAROOP

    Refer to below example –
    I have a RouteConfig class:
    public class RouteConfig
    {
    private static string ControllerAction = "ApiControllerAction";

    public static void RegisterRoutes(RouteCollection routes)
    {
    routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

    routes.MapHttpRoute(
    name: ControllerAction,
    routeTemplate: "api/{controller}/{action}/{id}",
    defaults: new { id = RouteParameter.Optional }
    );
    }
    }

    The call into the API uses JSON.Stringify:
    $.ajax("http://localhost:50762/api/values/PostSavePage/", {
    data: JSON.stringify(jObject),
    contentType: 'application/json',
    type: 'POST'
    });

Leave a Reply
Guest User

Not sure what course is right for you?

Choose the right course for you.
Get the help of our experts and find a course that best suits your needs.


Let`s Connect