Question

How can I implement it in the jQuery Autocomplete?

    $("#searchForm input").autocomplete({
        source: function (request, response) {
            $.ajax({
                url: "http://en.wikipedia.org/w/api.php",
                dataType: "jsonp",
                data: {
                    maxRows: 10,
                },
            });
        },

    });
Was it helpful?

Solution

edit:

if you look at this example, you'll see a remote call with jsonp example

look at the source of their example and the sucess function. It looks like they are mapping the jsonp fields to use the data as needed for the autocomplete. use fiddler to see the json coming down from their example.

success: function( data ) {
 response( $.map( data.geonames, function( item ) {
                        return {
                            label: item.name + (item.adminName1 ? ", " + item.adminName1 : "") + ", " + item.countryName,
                            value: item.name
                        }
                    }));
                }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top