Mouad Debbar
Mouad Debbar

Reputation: 3226

JsHelper::domReady function doesn't work !

I'm using CakePHP to develop a website..

I'm using the latest jQuery library..
using JsHelper to do something like this:

$this->Js->domReady ( $this->Js->alert ('Page loaded !') );

but no JavaScript code was generated on the page !!
this is supposed to generate something similar to:

$(document).ready(function(){alert("Page loaded !");});

I'm really surprised !!
is it a problem with jQuery engine ?
does the same problem exist with other libraries ?

any help will be appreciated ...

Upvotes: 0

Views: 1288

Answers (2)

sibidiba
sibidiba

Reputation: 6360

Do you do:

echo $this->Js->writeBuffer();

The call above only constructs the JS code, it does not include it in the document.

Upvotes: 0

Nik Chankov
Nik Chankov

Reputation: 6047

Did you try to make it like:

echo $this->Js->domReady ( $this->Js->alert ('Page loaded !') );

Although I use CakePHP as main framework in my development I am not using Js helper. I believe that Javascript need to stay aside. :)

Upvotes: 2

Related Questions