2008年12月15日星期一

[fw-mvc] Request parameters and dojo JsonRestStore

Hello,

I'm trying to build a JsonRest server using php Zend Framework and I'm having a little problem getting the request parameters on POSTs. I'm using this :
 private function _POST($params)
    {
        $request = $this->getRequest();
        $params = $request->getParams();
        if(!isset($params['testID']))
            return $this->sendJson("Error, testID is not set");
        ...
   }  

Now the dojo client is sending a testID parameter with data in it (see down) but I don't seem to be able to get the parameters from inside the _POST function.
Isn't the getParams() function supposed to send back all the parameters of a request ?
Why doesn't this works for a xhr request ?

Thanks,


dojo client :

var a = tstore.newItem();
tstore.setValue(a, "testID", "Test");

tstore.save({
onComplete: function(){ console.debug("save ok");},
onError: function(err){
console.debug("error:", err);
}
});

没有评论: