Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript MVC Can';不要使用某些JS库_Javascript_Jquery_Asp.net Mvc_Twitter Bootstrap_Bootstrap Typeahead - Fatal编程技术网

Javascript MVC Can';不要使用某些JS库

Javascript MVC Can';不要使用某些JS库,javascript,jquery,asp.net-mvc,twitter-bootstrap,bootstrap-typeahead,Javascript,Jquery,Asp.net Mvc,Twitter Bootstrap,Bootstrap Typeahead,我在我的项目中添加了一个新的js库(typeahead.bundle.js),每当我尝试调用任何函数时,它都会声称它们不存在。它似乎是在jQuery中而不是在我的库中查找: Uncaught TypeError: $(...).typeahead is not a function (anonymous function) @ Create:50 x.Callbacks.c @ jquery-1.10.2.min.js:21 x.Callbacks.p.fireWith @ jquery-1.1

我在我的项目中添加了一个新的js库(typeahead.bundle.js),每当我尝试调用任何函数时,它都会声称它们不存在。它似乎是在jQuery中而不是在我的库中查找:

Uncaught TypeError: $(...).typeahead is not a function
(anonymous function) @ Create:50
x.Callbacks.c @ jquery-1.10.2.min.js:21
x.Callbacks.p.fireWith @ jquery-1.10.2.min.js:21
x.extend.ready @ jquery-1.10.2.min.js:21q @ jquery-1.10.2.min.js:21
我还发现jQueryUI存在这个问题

相关用法:

<script src="/Scripts/typeahead.bundle.js"></script>

<script type="text/javascript">
    $(document).ready(function () {
    $( "#MemberSearch" ).typeahead({ //error line
            source: function (request, response) {
                $.ajax({
                    url: "/Operations/AutoCompleteMember",
                    type: "POST",
                    dataType: "json",
                    data: { term: request.term },
                    success: function (data) {
                        response($.map(data, function (item) {
                            return { label: item.Member, value: item.Member };
                        }))

                    }
                })
            },
            messages: {
                noResults: "", results: ""
            }
        });
    })
</script>

$(文档).ready(函数(){
$(“#成员搜索”).typeahead({//错误行
来源:功能(请求、响应){
$.ajax({
url:“/Operations/AutoCompleteMember”,
类型:“POST”,
数据类型:“json”,
数据:{term:request.term},
成功:功能(数据){
响应($.map)(数据、功能(项){
返回{label:item.Member,value:item.Member};
}))
}
})
},
信息:{
否结果:“”,结果:“”
}
});
})


@Label(“成员搜索”,htmlAttributes:new{@class=“control Label col-md-2”})
@TextBox(“MemberSearch”,“”,htmlAttributes:new{@class=“form control btn group”})

尝试安装,在包含jquery后添加脚本链接
,然后它工作

尝试安装,在包含jquery后添加脚本链接
,然后它工作

是否加载了
typeahead
库?错误明确表示没有。@Satpal还不够吗?我还可以用什么方式加载库?您是否加载了
typeahead
库?错误明确表示没有。@Satpal还不够吗?还有什么方法可以加载库?不幸的是,这没有帮助,当我查看源代码时,它删除了“~”而我仍然得到错误。@KenLund,我刚刚在我的解决方案中添加了typehead nuget包,插入了到js的链接,粘贴了你的代码,它就工作了!:)但是我使用bootstrap3-typeahead.js不幸的是,这没有帮助,当我查看源代码时,它删除了“~”而我仍然得到了错误。@KenLund,我刚刚在我的解决方案中添加了typehead nuget包,插入了到js的链接,粘贴了你的代码,它就工作了!:)但是我使用bootstrap3-typeahead.js
<div class="form-group">
            @Html.Label("Member Search", htmlAttributes: new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.TextBox("MemberSearch", "", htmlAttributes: new { @class = "form-control btn-group" })
                <button type="button" onclick="" class="btn btn-group" aria-label="Left Align">
                    <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
                </button>
            </div>
        </div>