JQuery: Yahoo Autocomplete / Autosuggest

I am trying to get yahoo autocomplete.

Yahoo JSON url is: http://ff.search.yahoo.com/gossip?output=fxjson&command=query

So, I have a:

   $("selector").autocomplete({
        source: function( request, response ) {
            $.ajax({
                url: "http://ff.search.yahoo.com/gossip",
                dataType: "jsonp",
                data: {
                    "output" : "fxjson",
                    "command" : request.term
                },
                success: function( data ) {
                    response(data[1])
                }
            })
        }
    });

And here is an example: http://jsfiddle.net/yQbdb/

Can someone spot a mistake or what am I doing wrong? It should work.

thank

+5
source share
1 answer

Setting outputup jsonpworks for me.

See an example query for an output structure.

Explanation below.

The code is HERE .

$("#wd6450").autocomplete({
    source: function(request, response) {
        $.ajax({
            url: "http://ff.search.yahoo.com/gossip",
            dataType: "jsonp",
            data: {
                "output": "jsonp",
                "command": request.term
            },
            success: function(data) {
                var suggestions = [];
                // for each element in the data.gossip.results array ...
                $.each(data.gossip.results, function(i, val) {
                    // .. push the value of the key inside our array
                    suggestions.push(val.key);
                });
                // call response with our collected values
                response(suggestions);

            }
        });
    }
});

Explanation:

dataType: "jsonp", jQuery , JSONP. output: "fxjson", URL- this, , JSONP, .

, output: "jsonp", this, , , output JSONP - .

Amazon. $.ajax() this. Amazon webservice JSONP, callback .

, : Webservices Yahoo JSONP, ?output=jsonp URL-, $.ajax() output: "jsonp". Amazon webservice - . webservice, .

JSONP .

+1

All Articles