permission denied?

Discussion in 'Javascript' started by laredotornado@zipmail.com, Oct 24, 2006.

  1. Guest

    Hi,

    I'm trying to use the xmlHttpReq object to contact a URL on my server.
    But I'm getting a JS "Permission denied" error at the indicated line.
    What does it mean and how can I get around it?

    function signUp(signUpElt) {
    if (!ValidEmail(signUpElt.value)) {
    alert("Please enter a valid email address.");
    return;
    } // if

    var xmlHttpReq = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
    self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
    self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    var strURL =
    "http://mydomain.myhost.com/add_email_response.php?EmailP=" +
    escape(signUpElt.value);
    self.xmlHttpReq.open('GET', strURL, true); // throws
    "Permission denied" JS error.


    Thanks for any help, - Dave
    , Oct 24, 2006
    #1
    1. Advertising

  2. VK Guest

    wrote:
    > I'm trying to use the xmlHttpReq object to contact a URL on my server.
    > But I'm getting a JS "Permission denied" error at the indicated line.


    "http://mydomain.myhost.com"

    is this line (it's real representation I mean) *identical* to the
    corresponding part of the URL where your script is located?

    For example
    http://somedomain.myhost.com
    and
    http://otherdomain.myhost.com
    are not the "same" in the cross-domain lock sense.
    VK, Oct 24, 2006
    #2
    1. Advertising

  3. ASM Guest

    a écrit :
    > Hi,
    >
    > I'm trying to use the xmlHttpReq object to contact a URL on my server.
    > But I'm getting a JS "Permission denied" error at the indicated line.
    > What does it mean


    do you request to same domain your file is ?

    if not : you can't do that -> permission denied !

    if yes :
    what does do this 'self' in :
    self.xmlHttpReq.open(
    what do you expect ?

    xmlHttpReq.open() open connexion to desired file (not much more)

    then, latter, on server's answer you'll treat the responseText



    var http_request;

    function signUp(signUpElt) {
    if (!ValidEmail(signUpElt.value)) {
    alert("Please enter a valid email address.");
    return;
    }
    http_request = false;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
    http_request = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
    http_request = new ActiveXObject("Microsoft.XMLHTTP");
    }
    var strURL="http://mydomain.myhost.com/add_email_response.php?EmailP="+
    escape(signUpElt.value);
    http_request.onreadystatechange = function() { showContents(strURL) };
    http_request.open('GET', strURL, true);
    http_request.send(null);
    }

    function showContents(url) {
    if (http_request.readyState == 4) {
    if (http_request.status == 200) {
    var req_content = http_request.responseText;
    document.getElementById('content').innerHTML = req_content;
    }
    else {
    alert('Something wrong with this request.');
    if(confirm('Do I try to open the new page?'))
    location.href=url;
    }
    }
    }


    --
    ASM
    ASM, Oct 24, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Goblin
    Replies:
    1
    Views:
    8,426
  2. Chris
    Replies:
    1
    Views:
    838
    Roy Johnson
    Oct 28, 2003
  3. Kevin Spencer
    Replies:
    3
    Views:
    2,987
    Kevin Spencer
    Aug 15, 2003
  4. Dave M.
    Replies:
    0
    Views:
    448
    Dave M.
    Nov 18, 2003
  5. =?Utf-8?B?ZmVzdGl2YWxtYW4=?=

    permission denied on an asp that's sending mail

    =?Utf-8?B?ZmVzdGl2YWxtYW4=?=, Jan 26, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    1,959
    Chris Jackson
    Jan 26, 2004
Loading...

Share This Page