SitePoint Sponsor

User Tag List

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

    access denied on ajax using relative path!

    Hello all,

    I have a very interesting probelm. i'm getting "access denied" error using XmlHttpRequest.open() while using relative path as the URL!

    the code:

    var url = "/out";
    url = url + "?data=xxx";
    url = url + "&cb=" + Math.random();
    xmlHttp.open("GET",url,true);


    Does it make any sense?

    Evyatar

    BTW
    I'm using IE7

  2. #2
    SitePoint Guru
    Join Date
    Apr 2006
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Use an absolute url-

    var L=location.href;
    L=L.substring(0,L.lastIndexOf('/'))

    url = L+url + "&cb=" + Math.random();


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
  •