.autocomplete is not a function Error

后端 未结 15 2338
抹茶落季
抹茶落季 2020-11-27 18:19

below is my My Code




        
15条回答
  •  佛祖请我去吃肉
    2020-11-27 19:02

    My issue ended up being visual studio catching an unhandled exception and preventing the script from running any further. Because I was running in the IDE, it looked like there was an issue when there wasn't. Autocomplete was working just fine. I added a try/catch block and that made the IDE happy.

     $.ajax({
                url: "/MyController/MyAction",
                type: "POST",
                dataType: "json",
                data: { prefix: request.term },
                success: function (data) {
                    try {
                        response($.map(data, function (item) {
                            return { label: item.Name, value: item.Name };
                        }))
                    } catch (err) { }
    
                }
            })
    

提交回复
热议问题