I have controller method in my MVC application that I am calling using the jQury $.post...
. The call is executing correctly, processing and sending a valid result back to the view for rendering. If I alert the result everything is received on teh client as expected but the data is not rendered to the view.
The controller mehtod is as below
public ActionResult SearchWithCriteria(string search)
{
var companyList = new Companies().SearchCompanies(search);
return PartialView ("Partials\\SearchResults", new SearchViewModel() { SearchResults = companyList });
}
and the jQuery is as below
$("#submit").bind("click", function () {
var searchCriteria = $("#SearchCriteria").val();
if (searchCriteria.length > 0) {
$.post('/Search/SearchWithCriteria', { search: searchCriteria }, function (data) {
alert(data);
$("companyDetailsSearch").html(data);
});
}
});
The partial is strongly typed and if I put breakpoints on the code I can step through it, but as I say nothing is rendered by the view.