Sometimes, after making an AJAX request, we want to use JS scripts in the view of AJAX function.
I was having a trouble with that after switching to 2.0.5 version - a simple AJAX view, including only a text message and a bit of JavaScript code - didn't render and run the script at all.
The solution for this is an evalScripts option in JsHelper.
If you want your AJAX view to display and run <script>'s, simply add this option to your AJAX call.
For example:
<?php
echo $this->Js->link('update',
array('controller' => 'controller', 'action' -> 'action'),
array(
'update' => '#id_of_element_to_update',
'evalScripts' => true,
)
);
?>
No comments:
Post a Comment
Thank you for leaving your comment:-)