Jquery search box auto-suggestion

Add an automatic prompt drop-down function to the text box. For example, if you enter 1, the fields containing 1 will be queried from the background database, and a drop-down list will be added to the text box for users to choose.

ajax returns a json collection whose data is the search query field

<script src="../../Scripts/JqueryUInew/jquery.autocomplete.js" type="text/javascript"></script>

    <link href="../../Scripts/JqueryUInew/jquery.autocomplete.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        $(function() {

        $("#txtCourseNameSearch").autocomplete("../AutoCompleteTextView/AutocompleteCourse.ashx?id=3", {
                dataType: "json",
                selectFirst: false,
                highlight: false,
                multiple: true,
                multipleSeparator: " ",
                scroll: true,
                scrollHeight: 300

            });
        });
        </script>

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324654972&siteId=291194637