所以我有一个共享的布局。我想在该布局上有一个搜索表单。进行搜索时,我想将结果返回到灯箱中。我不是最擅长 JS 的。这是我所拥有的:
共享布局:
<div id="search-form">
@Html.Action("Search", "RespondentSearch")
</div>
<div id="search-results">
</div>
控制器:
[HttpGet]
[Whitelist]
public ActionResult Search()
{
return PartialView("_SearchFormPartial");
}
[HttpPost]
[Whitelist]
public ActionResult Search(string query)
{
return PartialView("_SearchResultsPartial");
}
搜索表单部分视图:
@using (Ajax.BeginForm("Search", "RespondentSearch", FormMethod.Post,
new AjaxOptions
{
InsertionMode = InsertionMode.Replace,
HttpMethod = "POST",
UpdateTargetId = "search-results"
},
new
{
@class = "sidebarSearch"
}
))
{
<div>
<input type="text" name="search" placeholder="respondent search..." id="ac" class="ui-autocomplete-input" autocomplete="off" />
<span role="status" aria-live="polite" class="ui-helper-hidden-accessible"></span>
<input type="submit" value="" rel="lightbox" />
</div>
}
部分搜索结果:(整个表格就是我想要在 Lightbox 中出现的内容)
<table>
<tr>
<td>Stuff in Here</td>
</tr>
</table>