Here is relevant code:
Code: Select all
In IndexController:
public function init()
{
//other stuff
$ajaxContext = $this->_helper->getHelper('AjaxContext');
$ajaxContext->addActionContext('save', 'html')
->initContext();
}
public function saveAction()
{
//Shouldn't need to do this?
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$fname = $this->getRequest()->getParam('fname');
$this->user->setFname($fname);
$this->user->save();
$response = new Zend_Controller_Response_Http();
$this->setResponse($response);
echo 'fcku';
}
Code: Select all
Javascript:
function saveData(event)
{
var fname = $('#fname').value();
$.post("./index/save", "fname="+fname, alert("fucku"));
event.preventDefault();
return false;
}
