[英]How to get suggestions(auto complete) from database in parse.com using javascript on filling a form,example for car manufacturers?
我正在创建一个应用程序,用户必须在其中输入他们的汽车详细信息。我已经创建了一个表格,并且能够成功将输入数据更新到Parse.com上的数据库中。我想使用parse.com中的数据库来创建自动完成建议作为下拉菜单。
We use jQuery and Javascript to create this HTML code 我们使用jQuery和Javascript创建此HTML代码
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css">
<script>
$(function() {
var availableTags = [
"ActionScript",
"AppleScript",
"Asp",
"BASIC",
"C",
"C++",
"Clojure",
"COBOL",
"ColdFusion",
"Erlang",
"Fortran",
"Groovy",
"Haskell",
"Java",
"JavaScript",
"Lisp",
"Perl",
"PHP",
"Python",
"Ruby",
"Scala",
"Scheme"
];
$( "#tags" ).autocomplete({
source: availableTags
});
});
</script>
For the strings in the availableTags[] array, a parse.com cloud code loops through all the "suggestions" in the parse.com classes and stream them to the client's browser. 对于availableTags []数组中的字符串,parse.com云代码循环遍历parse.com类中的所有“建议”,并将它们流式传输到客户端的浏览器。
An real life example is available for your review at https://formgram.parseapp.com/formPage?formObjectId=KjuAOvq57n&formInstanceObjectId=Mb5iZfiWX6 您可以在https://formgram.parseapp.com/formPage?formObjectId=KjuAOvq57n&formInstanceObjectId=Mb5iZfiWX6查看真实示例
The state field is an autocomplete field. 状态字段是自动完成字段。 Currently, only 4 states have been added to this autocomplete.
目前,仅4个州已添加到此自动完成功能中。
You can even add more states to this autocomplete if you'd like by simply typing in the name of another state at https://formgram.parseapp.com/formPage?formObjectId=twDYgj32wK 如果您愿意,甚至可以通过在https://formgram.parseapp.com/formPage?formObjectId=twDYgj32wK中键入其他状态的名称,来向此自动完成功能添加更多状态
If you need additional help, let me know. 如果您需要其他帮助,请告诉我。
More details are available at http://jqueryui.com/autocomplete/ 有关更多详细信息,请访问http://jqueryui.com/autocomplete/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.