var getSite = function(e) {
YAHOO.util.Event.preventDefault(e);
// Set the datasource path
this.myDataSource = new YAHOO.util.DataSource("");
// Set the datasource connection method to POST
this.myDataSource.connMethodPost = true;
// Set the datasource type to JSON
this.myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
// Set the keys use from the JSON datasource
this.myDataSource.responseSchema = {
fields: ["csv_company_id","name"]
};
// Set the headers for each key
var myColumnDefs = [
{key:"csv_company_id", label:"Buxton CID"},
{key:"name", label:"Buxton Company Name"}
];
var myDataTable = new YAHOO.widget.DataTable("company-sites", myColumnDefs, myDataSource);
}
YAHOO.util.Event.addListener("dropdown-sites", "change", getSite);
YAHOO.util.Event.addListener(window, "load", getSite);