Kohana and Javscript path

Posted by Leonti on Stack Overflow See other posts from Stack Overflow or by Leonti
Published on 2010-04-18T16:16:46Z Indexed on 2010/04/18 16:23 UTC
Read the original article Hit count: 495

Filed under:
|

Hi! I have a following Kohana setup:

All my files are placed under 'public_html/koh' My js files are placed under 'public_html/koh/media/js/'

I use html::script helper to include those javascript files which generates me following html code:

In my js I access one of controllers like 'json/getsomething' (which is http://localhost/koh/json/getsomething).

It works OK as long as I'm staying in top of the controller: http://localhost/koh/home

When I go to 'http://localhost/koh/home/index' it renders the same page of course but 'json/getsomething' is not accessible from Javascript anymore.

How can I solve this problem?

Include Javascript using absolute path? Create a variable in js like var fullPath = 'http://localhost/koh/'?

What is the best practice to do it?

Leonti

© Stack Overflow or respective owner

Related posts about kohana

Related posts about JavaScript