I had the exact same problem and never got an answer:
http://groups.google.com/group/cake-php/browse_thread/thread/6a8bca31cbc37600/68463ae52185dd1a
http://groups.google.com/group/cake-php/browse_thread/thread/e96a87bb82267767
In the end, I abandoned the CakePHP ajax helper and did it in straight
javascript. It was much easier than I thought, and I learnt something
about the inner workings of ajax. I think you'll find it's quite
easier this way. IMO it's one of thoswe situations where the
simplified "helper" gets in the way, and the best is to get to the
nuts and bolts. I used the example from the book http://ajaxphp.packtpub.com/
and the free sample chapter that will give you a template to work from
for the ajax call http://ajaxphp.packtpub.com/1825_01_Final.pdf
Good luck
On Dec 2, 3:40 am, tobi_one <tobias.h...@gmail.com> wrote:
> Hi,
>
> I have the following situation:
> A view where I call an AJAX helper with following options:
>
> <?php $options = array(
> 'url' => array('controller' => 'users', 'action'=>'login'),
> 'before' => 'startLoadingLogin()',
> 'complete' => 'endLoadingLogin()',
> 'failure' => 'alert(\'Error\')'
> );
> ?>
>
> Once the AJAX call is completet the JS function endLoadingLogin() is
> called. In this function I want to access a return value that I wrote
> in the controller like this:
>
> echo "1";
> $this->render(null,'ajax');
>
> How can I access the return value of this AJAX call in my
> endLoadingLogin() function?
>
> I have tried accessing things like:
>
> var response = t.responseXML.documentElement;
> var response = oXmlHttp.responseText;
>
> in endLoadingLogin() but they don't seem to work and I don't see how
> they should work anyway, because there is no connection between the
> response variable and the AJAX call...
>
> Any ideas are highly appreciated!
>
> cheers,
> tobi_one
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---
No comments:
Post a Comment