I have an array that resides on the same domain as my html and I want to use the array as the source for an autocomplete textbox. Contents of myarr.json (1 MB):
["Aaronsburg, PA", "Abanda, AL", "Abbeville, AL", "Abbeville, GA" ... ]
I am using YUI2: AutoComplete and it works if I embed (a portion of) the array like this:
var myDataSource = 
开发者_如何学Python    new YAHOO.util.LocalDataSource(["Aaronsburg, PA", "Abanda, AL"]);
but my array is huge so I must link to it. When I do that:
var myDataSource = 
    new YAHOO.util.LocalDataSource("http://mydomain.com/myarr.json");
the console responds: GET http://mydomain.com/myarr.json/search/aarons/other/data 404 (Not Found)
How do I turn my array into json that can respond to the /search component of that GET statement?
If you want to "link" to it, you should just use the Remote Datasource.
The Examples go through how to Customize your datasource parsing.
YUI has very extensive documentation on all of this.
[Edit]
In response to your comment, see the Datasource Docs
Mainly under "Simple JavaScript Array",
myDataSource.responseSchema = {
    fields: ["name"]
};
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论