Tag: jquery autocomplete

将JSON数组从c#传递给jQuery

我正在做jQuery自动完成。 如果我把硬编码的JSON数组放入工作正常。 但是当我从c#传递数组时它失败了。 请帮助,我花了足够的时间,我被卡住了! 这是我在AutoComplete.aspx中的jQuery代码 $(document).ready(function () { var msgbox = $(“#status”); $.ajax({ type: “POST”, //Page Name (in which the method should be called) and method name url: “AutoControl.aspx/GetData”, //else If you don’t want to pass any value to server side function leave the data to blank line below data: “{}”, contentType: “application/json; charset=utf-8”, dataType: […]

ASP.Net MVC Jquery UI自动完成 – 我调试时没有显示列表

我已在我的应用中为邮政编码实施了自动填充function。 我在Firebug中进行调试,我在控制台中看到操作正在执行,我在结果列表中得到了一个邮政编码列表,但是当我调试时,实际列表没有显示。 这是我的Customers控制器中的操作: //the autocomplete request sends a parameter ‘term’ that contains the filter public ActionResult FindZipCode(string term) { string[] zipCodes = customerRepository.FindFilteredZipCodes(term); //return raw text, one result on each line return Content(string.Join(“\n”, zipCodes)); } 这是标记(缩写) 这是我加载脚本的顺序: $(document).ready(function() { $(“#ZipCodeID”).autocomplete({ source: ”}); }); 有什么明显我想念的吗? 就像我说脚本正在抓取邮政编码列表一样,我测试时它们不会显示在我的页面上。 编辑:我添加了一个图像,显示我在firebug中看到的内容 – 看起来我收到了我的邮政编码,但是不会显示下拉列表。 我还更新了我的文本框,以便它在ui-widget div中,如下所示: 这是我正在使用的脚本: $(document).ready(function() { $(“#ZipCodeID”).autocomplete(”); });