アクションが呼び出されますが、選択するページに結果が表示されません。
<script>
$(document).on("pageinit", "#pageHome", function () {
$("#autocomplete").on("listviewbeforefilter", function (e, data) {
var $ul = $(this),
$input = $(data.input),
value = $input.val(),
html = "";
$ul.html("");
if (value && value.length > 2) {
$ul.html("<li><div class='ui-loader'><span class='ui-icon ui-icon-loading'></span></div></li>");
$ul.listview("refresh");
$.ajax({
url: "@Url.Action("Search","Schedule")",
data: {
q: $input.val()
}
})
.then(function (response) {
$.each(response, function (i, val) {
html += "<li>" + val + "</li>";
});
$ul.html(html);
$ul.listview("refresh");
$ul.trigger("updatelayout");
});
}
});
});
</script>
<div data-role="page" id="pageHome">
<ul id="autocomplete" data-role="listview" data-inset="true" data-filter="true" data-filter-placeholder="Find a city..." data-filter-theme="d"></ul>
</div>
//探す
public ActionResult Search(string term)
{
return new JsonResult
{
Data = _Service.FindAllByWildCard(term)
.Select(p => new { p.Name}).ToArray(),
JsonRequestBehavior = JsonRequestBehavior.AllowGet
};
}