Search code examples
ajaxcakephpprototypejs

Error: $(document).ready is not a function


I understand this question has been asked multiple times on various sites and forums however the context has mostly been jquery. In my case, I am not using jquery at all though I am using CakePHP 1.3 with prototype and scriptoculous. I am trying to make Ajax pagination work using default Js helper however every time I load the page, I get the error below in error console

Error: $(document).ready is not a function

Any idea what's wrong here.


Solution

  • It seems (after some googeling) that the syntax to use in prototype is document.observe('dom:loaded', fn);

    http://www.prototypejs.org/api/document/observe