$myBlock = $this->getLayout()->createBlock('module/admin_productqa_edit');
$myHtml = $myBlock->toHtml();
$response['blck'] = $myHtml;
above code work perfect. I need Given below value return as ajax response from controller in magento. How to set ajax response in magento
$this->_addContent($this->getLayout()->createBlock('module/adminhtml_productqa_edit'));
$this->_addLeft($this->getLayout()->createBlock('module/admin_productqa_edit_tabs'));
Please Give a perfect solution
Lord Skeletor
4,0481 gold badge17 silver badges19 bronze badges
1 Answer 1
You can set ajax response like this:
$response = array(
'myblock' => $this->getLayout()->createBlock('module/admin_productqa_edit')->toHtml()
);
$this->getResponse()->setBody($response);
You can't use $this->_addContent or $this->_addLeft when doing ajax call because you are not loading entire layout object. You are supposed to process the response and update DOM with javascript.
answered Jan 30, 2015 at 13:55
Lord Skeletor
4,0481 gold badge17 silver badges19 bronze badges
default