The jQuery code to do this looks something like: $. I perform an AJAX request that has 2 possible responses: one that redirects the browser to a new page and one that replaces an existing HTML form on the current page with a new one. 27 This is how I redirect from my Controller to another Route: return this->redirect ()->toRoute ('dns-search', array ( 'companyid' > this->params ()->fromRoute ('companyid') )) Where dns-search is the route I want to redirect to and companyid are the url params. The JavaScript on the client can then use the JSON object to decide what it needs to do. (.) is better than using, because replace() does not keep the originating page in the session history, meaning the user won't get stuck in a never-ending back-button fiasco. jQuery is not necessary, and (.) will best simulate an HTTP redirect. In this case, all responses to AJAX requests have the status code 200 and the body of the response contains a JSON object that is constructed on the server. One does not simply redirect using jQuery. master zf1/library/Zend/Controller/Action/Helper/Redirector.php Go to file Cannot retrieve contributors at this time 534 lines (483 sloc) 15.3 KB Raw Blame
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |