Category Archives: javascript

Updating multiple divs with Ajax. Without crashing Firefox

In an earlier post I showed you how you can update multiple divs with Ajax. But there was one problem: it crashed Firefox on my machine, and other people reported the same problem, whereas it worked for others… In a comment, Josh Southern, pointed me to the cause of the problem: the “latest” version, 1.4, […]

A simple redirect component

I already wrote about doing a redirect with Ajax. Now, I created a simple component from that code I presented there: // app/controllers/components/redirect.php class RedirectComponent extends Object { var $controller; var $components = array(‘RequestHandler’); function startup(&$controller) { $this->controller =& $controller; } function goto($url) { if ($this->RequestHandler->isAjax()) { $this->controller->set(‘url’, $url); } else { $this->controller->redirect($url); } } […]

Redirect with Ajax

In my current project I have a login form I want to validate with Ajax. If everything is ok, the user should be redirected to the respective start page. As it seems to be impossible to do the redirect on the server-side (at least to me), I do it on the client-side. I use the […]

Let’s crash Firefox!

Today I was able to crash Firefox with a very simple JavaScript. That is the JavaScript: <script type=”text/javascript”> function sayHello() { alert(‘hello’); } sayHello(); </script> Well, that script works as expected if you have it in a “normal” view. But it leads to a “Segmentation fault” (and therefore to a crash of Firefox) if the […]

Nice Date-Picker Widget

frequency decoder presents a nice date-picker widget. At the bottom of the page, there are also links to other useful Javascripts. I especially like the slider control which looks very cool! [via Olle’s bookmarks]

How can I toggle the visibility of elements?

If you work with the Prototype Javascript Framework (you need this framework if you want to use the Ajax functionality of CakePHP), it is very easy to toggle the visibility of elements. A simple example: <?php echo $html->checkbox(‘MyCheckbox’, null, array(‘onclick’ => “Element.toggle(‘message’);”)); ?> <div id=”message” style=”display: none;”> Checkbox is selected. </div>