Monday, September 27, 2010

Action with Json return

If you need to create an action in Magento with content Json as return, you can use this procedure/code :

        $reponse =  new Varien_Object( );       
        ...
        $reponse->setTimeserver( Mage::getModel('core/locale')->storeTimeStamp(   Mage::app()->getStore() ) );
         ... ... ...
        $this->getResponse()->setBody ( $reponse->toJson() );

No comments:

Post a Comment

Powered by Blogger.