The jQuery code to do this looks something like: $. This example describes the Zend Framework action Assistant redirector usage. 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. The JavaScript on the client can then use the JSON object to decide what it needs to do. 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. For instance, when browsing through a paginated data set, one may want a form’s action attribute to point to the current page, such that the user will end on the same page upon postback. Even though this worked, I was a little dissatisfied as it is a bit of a hack.Īfter more digging around, I ditched this approach and used JSON. In a view script in Zend Framework 2, one may need to generate an URL for a given route that includes one or more query parameters. I read this question and implemented the approach that has been stated regarding setting the response HTTP status code to 278 in order to avoid the browser transparently handling the redirects. ZendControllerAction is an abstract class you may use for implementing Action Controllers for use with the Front Controller when building a website based on the Model-View-Controller ( MVC) pattern. gotoRoute (array urlOptions array (), string name null, boolean reset false, boolean encode true ) : void.
0 Comments
Leave a Reply. |