我有以下代码。该URL指向MVC Webapi端点。当我加载页面时,不会调用URL。有人可以帮忙吗?
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="css/typeahead.css" />
<script type="text/javascript" src="scripts/jquery-2.1.1.js"></script>
<script type="text/javascript" src="scripts/typeahead.bundle.js"> </script>
<script type="text/javascript" src="scripts/bootstrap.min.js"></script>
<script type="text/javascript" src="scripts/require.js"></script>
<script type="text/javascript" src="scripts/bloodhound.js"></script>
<script src="//twitter.github.com/hogan.js/builds/3.0.1/hogan-3.0.1.js"> </script>
</head>
<body>
<input type="text" id="searchText" class="form-control typeahead" data-provide="typeahead" placeholder="Search" value=""
autocomplete="off">
</body>
</html>
<script>
$(document).ready(function() {
$('#searchText').typeahead(null,
{
name: 'address',
remote: {
url: '/SearchWebAPI/api/searchitem'
}
}
);
});
</script>
答案 0 :(得分:0)
我现在从Webapi中检索数据。我现在使用的是Twitter Typeahead,而不是Twitter Bootstrap。这让我很困惑。另外,我还不了解如何使用Bloodhound库。感谢这个答案,告诉我如何:Typeahead and Bloodhound - how to get JSON result