0
$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
asked Jan 30, 2015 at 13:30
0

1 Answer 1

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

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.