*/ class Mage_Captcha_RefreshController extends Mage_Core_Controller_Front_Action { /** * Refreshes captcha and returns JSON encoded URL to image (AJAX action) * Example: {'imgSrc': 'http://example.com/media/captcha/67842gh187612ngf8s.png'} * * @return null */ public function indexAction() { $formId = $this->getRequest()->getPost('formId'); $captchaModel = Mage::helper('captcha')->getCaptcha($formId); $this->getLayout()->createBlock($captchaModel->getBlockName())->setFormId($formId)->setIsAjax(true)->toHtml(); $this->getResponse()->setBody(json_encode(array('imgSrc' => $captchaModel->getImgSrc()))); $this->setFlag('', self::FLAG_NO_POST_DISPATCH, true); } }