Like validkeys already said, when you load content via AJAX, you're
just dynamically modifying the HTML of the page. Any javascript you
include is dumped into the page just the same, but the difference is
that a typical AJAX call isn't smart enough to parse out the
javascript and pass it to the browser for processing.

The proper way to accomplish what you're trying to do would be to
trigger your extra script in one of the AJAX helper's callback
functions. When the thank you page successfully loads, then trigger
your code.

http://api.cakephp.org/1.2/class_ajax_helper.html

If you look in $ajaxOptions, you'll see the ability to define an
onComplete callback where you can trigger your desired code.

- James

On May 5, 7:19 am, Bartek Muracki <[EMAIL PROTECTED]> wrote:
> Hi guys,
>
> I've stumbled upon a stupid problem with loading an external
> Javascript file from within the AJAX view. Is this a desired behavior
> of a framework, as it could mess things up? What I'm trying to achieve
> is an AJAX form that should fire up Google conversion tracker script
> when it's been submitted and user is presented the "thank you" screen.
>
> The view is being loaded with $this->render('thank_you','ajax') from
> the controller.
>
> Any idea how to fix this one?
>
> Best,
> Bartek

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to