CakePHP Js->get() operation on div
I am reading the CakePHP manual about Js implementations, and I am trying to run some jQuery on a div, but I cannot get it working in my view. I have all of m开发者_JAVA技巧y Helpers and jQuery being pulled in.
As a test, I am just trying to get this element to fade in:
$this->Js->get('#resultsWrapper');
$this->Js->effect('fadeIn');
<div id="resultsWrapper">THIS IS A FADE IN TEST</div>
Its loading as normal..
Make sure the element is display: none;
That will allow it to actually fade in rather than just be loaded
I solved this by altering the syntax of the prototype call. The manual suggested get() does not seem to work properly (at least from the hours and hours of experimenting I did)..
This is how I solved this: (note the loading and success sections).
<?php
echo $ajax->submit('Submit',
array('url'=> array('controller'=>'records',
'action'=>'add'), 'update' => 'ajax_div',
'evalScripts' => true,
'loading' => 'Element.show(\'busy-indicator\')',
'success' => 'Element.hide(\'busy-indicator\')'
));
?>
精彩评论