2015-05-11 44 views
1

我有以下代碼。該URL指向MVC Webapi端點。當我加載頁面時,URL不會被調用。任何人都可以幫忙嗎?Twitter引導類型提前遠程不工作

<!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

我現在正在從Webapi檢索數據。我現在使用的是Twitter Typeahead,而不是Twitter Bootstrap。這讓我很困惑。另外,我不明白如何使用Bloodhound庫。感謝這個答案給我展示瞭如何:Typeahead and Bloodhound - how to get JSON result