简体   繁体   中英

Zend Framework and jQuery - passing objects between pages

I may have coded myself into a corner here. I am developing a chat application in Zend Framework. What I have is an "action" page ( action.phtml ) that handles all of the requests sent by jQuery (which is loaded when index.phtml action fires). The action script runs static methods and returns a json encoded response. ( $response = Chat::Static_Method )

My problem is, when I run the app, everything fires correctly, and I can see the various actions ( action.phtml?run=whatever ) in the browser console. What I can't seem to figure out is how to get index.phtml to read the response echoed onto action.phtml.

Any advice would be appreciated.

I wish I could have explained my problem more clearly. Posting code simply wasn't an option, there are literally dozens of files involved and several hundred lines of code for the chat app alone.

Turns out the issue was the layout. The json that my action page produced wasn't being consumed by the jquery because of all the other html around it. The solution was rather simple (after a night of reading through the documentation) - I simply deactivated the layout in that action;

$this->_helper->layout()->disableLayout();

SO, I hope this helps someone out... although I know this is a pretty unique problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM