I have several views that will be access inside modal boxes instead of actual pages. Because of this I wish to do the following:
- When a user submits content inside the modal, it will postback and then close the modal and then return the user to the page they are on (INSTEAD OF REFRESHING INSIDE THE MODAL)
Note: I will be passing a special JS function to close the modal but what about making sure the modal talks to the page it is being shown on? I’m using Jquery UI Dialog by the way
- If a user tries to access the page in their browser directly instead of in the modal then they will be redirected somewhere else or shown a 403
Can anyone help?
If I understood you correctly, you might need this: http://book.cakephp.org/view/1371/isAjax
in controller :
if ($this->requestHandler->isAjax()) { ... this is ajax request.. } else { ... non-ajax ...}