i am using the following javascript to pass parameters to server;

var obj = {nest_id:1, component_id:1};

data = dojo.toJson(obj);

var deferred = dojo.xhrPost({

url: "addtonest",

content: data

});



this seems ok, the data does arrive in the request.



How do i extract the parameters in my controller action? I have this;



function addtonestAction()

{

// Dissable view and layout.

$this->_helper->viewRenderer->setNoRender();

$this->_helper->layout()->disableLayout();

if ($this->_request->isPost()) {

$params = $this->_getAllParams();

//$params = Zend_Json::decode($this->_request->getParam[0]);

var_dump($params);

die;

$model = new Titanium_Model_NestComponents;

$model->insert($params);

}

}



the var dump gives this;



array(33) {
  ["controller"]=>
  string(5) "nests"
  ["action"]=>
  string(9) "addtonest"
  ["module"]=>
  string(7) "default"
  [0]=>
  string(1) "{"
  [1]=>
  string(1) """
  [2]=>
  string(1) "n"
  [3]=>
  string(1) "e"
  [4]=>
  string(1) "s"
  [5]=>
  string(1) "t"
  [6]=>
  string(1) "_"
  [7]=>
  string(1) "i"
  [8]=>
  string(1) "d"
  [9]=>
  string(1) """
  [10]=>
  string(1) ":"
  [11]=>
  string(1) "1"
  [12]=>
  string(1) ","
  [13]=>
  string(1) """
  [14]=>
  string(1) "c"
  [15]=>
  string(1) "o"
  [16]=>
  string(1) "m"
  [17]=>
  string(1) "p"
  [18]=>
  string(1) "o"
  [19]=>
  string(1) "n"
  [20]=>
  string(1) "e"
  [21]=>
  string(1) "n"
  [22]=>
  string(1) "t"
  [23]=>
  string(1) "_"
  [24]=>
  string(1) "i"
  [25]=>
  string(1) "d"
  [26]=>
  string(1) """
  [27]=>
  string(1) ":"
  [28]=>
  string(1) "1"
  [29]=>
  string(1) "}"
}


________________________________
-
Williams Refrigeration is a trading name of AFE Group Limited.
Registered in England & Wales under Registered Number 3872673. Registered
Office Address - Bryggen Road, North Lynn, Industrial Estate, Kings Lynn, 
Norfolk, PE30 2HZ

Williams Refrigeration filters email attachments for spam and viruses and 
malicious content with Sophos Puremessage. While every care has been made to 
ensure this message is secure we advise that you perform your own checks on 
this and any other inbound messages.

This e-mail and any files transmitted with it are confidential and intended 
solely for the use of the individual or entity to whom they are addressed. If 
you have received this email in error or are having trouble sending email to us 
please notify the system administrator - [email protected]

Any views or opinions expressed in this e-mail are those of the sender and do 
not necessarily coincide with those of Williams Refrigeration or the AFE Group.

Reply via email to