SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Nov 2007
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Arrow Permission denied XMLHttpRequest.open

    I am a NEWBIE... I am trying to get the Weather_widget code in the "SimplyJavaScript" book to run successfully.

    I have installed Apache 2.2, PHP 5.1. Tested the ajax_weather.php from the browser and it works. put when the following line executes:

    requester.open("GET",
    http://localhost/ForSimplyJavaScript/ajax_weather.php?city=" + encodeURIComponent(city), true);

    I get the following error:
    "uncaught exception: Permission denied to call method XMLHttpRequest.open

    The code is from the book but I'll attached it just in case...

    Thanks in advance!!!
    Attached Files Attached Files

  2. #2
    SitePoint Enthusiast
    Join Date
    Aug 2007
    Location
    Australia
    Posts
    33
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is the link pointing to the right place? Maybe double check it or make it relative...

    Code JavaScript:
    requester.open("GET", ajax_weather.php?city=" + encodeURIComponent(city), true);

    if its in the same folder as the script

  3. #3
    SitePoint Enthusiast
    Join Date
    Aug 2007
    Location
    Australia
    Posts
    33
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Actually I just came across an issue with using ajax across domains...

    The url is probably fine... apparently theres issues with using ajax to access other websites.... not sure its fixable

  4. #4
    SitePoint Member
    Join Date
    Nov 2007
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up I found the cause

    I had the php file in the localhost folder but the html/js elsewhere. Though the url was pointing at the right place, the html/js wsa being accessed ask File:// and therefore the domain conflict.

    Thanks for your quickly replies! I appreciate it!

    Kahren


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
  •