I am confusing about HTTP GET method in ASP.NET MVC.
Normally, if I create a View -> click button -> call controller -> controller returns JsonResult -> javascript gets the JsonResult and populate table in the View: everything works just fine. table
However, if instead of clicking the button, I directly call the HTTP Get by url (let's say: https://localhost:44378/MyController/Action?ID=123), then in my controller:
[HttpGet]
public JsonResult Action(string ID)
{
var Info = new List<MyModel>();
//some DB work here
return Json(Info, JsonRequestBehavior.AllowGet);
}
Then what I receive once I enter the url is only a screen filled with Json string. How could I make a view with table filled as expected?
I thought of passing the json string to JS using Viewbag, but I think there should be a more elegant way.