How do I return JSON data from a partial view FormMethod.Get?
Posted
by
MrM
on Stack Overflow
See other posts from Stack Overflow
or by MrM
Published on 2013-10-23T21:52:17Z
Indexed on
2013/10/23
21:53 UTC
Read the original article
Hit count: 308
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)
© Stack Overflow or respective owner