I need to post a form using Ajax, without affecting the navigation of
the browser.

I've set the form up using this syntax:

echo $ajax->form('/pages/updateMenusInSession', 'post', array("id" =>
"menuForm"));

I've set the event onunload in the body to submit the form when the
user is moving off the page....

<body onunload="onUnload()";>

function onUnload() {
        document.getElementById("menuForm").submit();
}

In the controller:

function updateMenusInSession() {
        $this->layout='ajax';
        ....
        $this->Session->write('myMenus', $menus);
        exit();
}

However, what is happening is that my navigation is getting screwed
and the browser is jumping to the ajax function e.g.

www.myurl.com/pages/updateMenusInSession

rather than

www.myurl.com/mainpage

Anyone have any suggestions as this is driving me nuts!
Thanks

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~----------~----~----~----~------~----~------~--~---

Reply via email to