Login Register

problems with getting items after store fetch

hey people....
after days of searching for an answer i post here...am in desperate need of help, hope someone can help me
i got a widget which has a store variable

var searchLocation = function(e) {
        var params = {
                query: {name1:"blabla"},
                onComplete: foo,
                onError: errorHandler
        };     
        this.dataStore.fetch(params);   
};

var foo = function(items,request) {     
        alert(items.length);
};

dojo.declare("modules.form.SearchLocationWidget",[dijit._Widget,dijit._Templated],
{
        templatePath: dojo.moduleUrl("modules.form","templates/SearchLocation.html"),
        templateString: "",
        src: "",
        widgetsInTemplate: true,
        _onClick: searchLocation,
        dataStore: new dojox.data.QueryReadStore(
                {url:"fetchData.php"}
        )
});

in fetchData.php i only got one line of code

print json_encode(array('items'=>array('name'=>$_GET['name1'])));

but the items array length is always 0...

I also tried with:

print json_encode($_REQUEST);

and serverQuery instead of query at params.....nothing worked for me....pleeeaasse help :/
thnx a lot..

best regards, giwon

I don't do much PHP, but it

I don't do much PHP, but it looks like you're creating a single object for 'items' rather than an array. (Even though it's called an array, it's actually an associative array -- the equivalent of a JavaScript object.) You need something like:

array('items'=>array(
  array('name'=>'some value')
  ));

how to get the data for chartting from server

All the examples i have seen for charting create the data for the charts on the client side. Can some one show how this can be done using json or sth of that sort.