AJAX Access is denied error

Discussion in 'JavaScript' started by sugarland, Mar 24, 2009.

  1. #1
    The following script will give access is denied error.

    xmlHttp.open("GET", "temp.xml", true) //temp.xml is a file under the same directory. However xmlHttp.open("GET", "http://www.adobe.com", true) will work fine.

    What's the problem?
     
    sugarland, Mar 24, 2009 IP
  2. xlcho

    xlcho Guest

    Messages:
    532
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You do not have permissions to access the file. Change it's mod (chmod) or owner (chown) to the appropriate permissions that your server runs with. You can just check the other files on the server and make the temp.xml the same.
     
    xlcho, Mar 25, 2009 IP
  3. dimitar christoff

    dimitar christoff Active Member

    Messages:
    882
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    90
    #3
    access denied implies a browser / method error in retrieval of file, not permission denied from webserver. easly checkable if he requests domainname.com/temp.xml and that works.

    if opening via domain works, have you tried putting in yours into the request? are you in a subfolder? xhttp also has restrictions for cross-domain actions which result in access denied...
     
    dimitar christoff, Mar 25, 2009 IP
  4. sugarland

    sugarland Member

    Messages:
    105
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    28
    #4
    Sorry, i'm testing the script on my computer, not on my server. Can we do test on our own computer of ajax scripts like xmlHttp.open("GET", "temp.xml", true)?
     
    sugarland, Mar 25, 2009 IP
  5. dimitar christoff

    dimitar christoff Active Member

    Messages:
    882
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    90
    #5
    no because that implies the browser can fetch any file from your hard drive. you need to run a local webserver and request your tests through it.
     
    dimitar christoff, Mar 25, 2009 IP