How do I return JSON data from a partial view FormMethod.Get?
- by MrM
I have the following code that posts to my Search Json. The problem is the url redirects to the json search and displays the raw json data. I would like to return to a table in my partialView instead. Any thoughts on how I can achieve this?
<div>
@using (Html.BeginForm("Search", "Home", Formmethod.Get, new {id="search-form"})){
...
<button id="search-btn">Search</button>
}
</div>
<div>
<table id="search-results">...</table>
</div>
My home controller works fine but to make sure the picture is clear...
public JsonResult Search(/*variables*/)
{
...
return Json(response, JsonRequestBehavior.AllowGet);
}
And I get redirected to "Search/(all my variables)