SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Addict tlacaelelrl's Avatar
    Join Date
    Apr 2011
    Location
    Mexico city, Mexico
    Posts
    353
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Javascript works only in some pages

    I donīt know if someone can answer this question here but I want to try.

    I have a joomla site, for which I have created a calendar, it is built with javascript and php, there is also an ajax request to update the calendar.

    The calendar works fine in the main page, but when I go to any other link the calendar stops working.

    This is the site

    Can anyone help me out with this?

  2. #2
    SitePoint Wizard bronze trophy chris.upjohn's Avatar
    Join Date
    Apr 2010
    Location
    Melbourne, AU
    Posts
    2,191
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    I looked at the Ajax requests and here is what i found.

    Home page - http://www.republica-tecnologica.com...e_calendar.php
    Other pages - http://www.republica-tecnologica.com...e_calendar.php

    What i recommend you do is set a var within your PHP script called siteURL or something to that extent and use the Joomla site url set in the database. Once that is set within the javascript before your Ajax request URL add the siteURL variable so it directs the request to the absolute URL rather then the relative URL.

  3. #3
    SitePoint Addict tlacaelelrl's Avatar
    Join Date
    Apr 2011
    Location
    Mexico city, Mexico
    Posts
    353
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by SgtLegend View Post
    I looked at the Ajax requests and here is what i found.

    Home page - http://www.republica-tecnologica.com...e_calendar.php
    Other pages - http://www.republica-tecnologica.com...e_calendar.php

    What i recommend you do is set a var within your PHP script called siteURL or something to that extent and use the Joomla site url set in the database. Once that is set within the javascript before your Ajax request URL add the siteURL variable so it directs the request to the absolute URL rather then the relative URL.
    I did not think that was needed, in Joomla 1.5 it works just fine, but it is not the case for Joomla 1.6, by calling JURI::root() I fixed the problem.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •