Loading ...
Sorry, an error occurred while loading the content.

Help on Autocomplete using ScriptNodeDataSource

Expand Messages
  • kennyth01
    Hi all, I m having a hard time working on proxyless server using JSON API of any feeds. One example is using Google AutoComplete feed. Here s my code: var oDS
    Message 1 of 1 , May 4, 2009
    • 0 Attachment
      Hi all,

      I'm having a hard time working on proxyless server using JSON API of any feeds.

      One example is using Google AutoComplete feed. Here's my code:

      var oDS = new YAHOO.util.ScriptNodeDataSource("http://suggestqueries.google.com/complete/search?nolabels=t&hl=en&ds=yt&client=suggest&json=t&jsonp=myCallbackMethod&q=");


      // I dont know if my mapping is correct, please guide me on this
      oDS.responseSchema = {
                 resultsList: [1],
                  fields : ["Text"]
              };

      var oAC = new YAHOO.widget.AutoComplete("myTextBox", "autocompleteContainer", oDS);
      oAC.queryDelay = .5;
      oAC.generateRequest = function(sQuery) {
                  return sQuery;
              };


      return {
                  oDS: oDS,
                  oAC: oAC
              };



      Here's a sample data of google response: myCallbackMethod(['ja',['java','jam','jack']])

      Any problems on my code? All I want is to get java, jam and jack to display in the auto complete. Any ideas on this? Hope to hear on you soon. Thanks in advance!
    Your message has been successfully submitted and would be delivered to recipients shortly.