Jump to content

Permission Denied to call method XMLHttpRequest.open


crims0nluv

Recommended Posts

Hi all,

 

I have this problem with my ajax. I'm very new in ajax and I hope someone can help me out with this.

 

This is my HTML button :

<input value="Go" type="button" onclick='javascript:xmlhttpPost("http://www.alldogsworld.com")'>

 

And this is my javascript

<script language="Javascript">

function xmlhttpPost(url) {

http_request = false;

    http_request = new XMLHttpRequest();

    if (http_request.overrideMimeType) {

      http_request.overrideMimeType('text/xml');

    }

    if (!http_request) {

      alert('Cannot create XMLHTTP instance');

      return false;

    }

    http_request.onreadystatechange = alertContents;

    http_request.open('POST', url, true);

    var form    = document.forms['form1'];

    var sms_count = form.sms_count.value;

    var sms = form.Mobile.value;

    var mobile=sms.split(" ");

    var ID = form.ID.value;

    var Password = form.Password.value;   

    var Type = form.Type.value;

    var Message = form.Message.value;

    qstr = 'ID=' + ID + '&Password=' + escape(Password) + '&Type=' + Type + '&Message=' + Message;

var i=0;

for(i=0;i<sms_count;i++) {

var Mobile=mobile;

alert(qstr+'&Mobile='+Mobile);

    http_request.send(null);

  }

</script>

 

I have tried modifying the prefs.js file,but then it only works for localhost, and I get the same error when I uploaded the file into the webserver. What should I do to eliminate the error ?

These are 3 lines I put in the prefs.js file in my own computer.

 

user_pref("capability.policy.XMLHttpRequestToAnySite.XMLHttpRequest.open","allAccess");

user_pref("capability.policy.XMLHttpRequestToAnySite.sites", "http://localhost");

user_pref("capability.policy.policynames", "XMLHttpRequestToAnySite");

 

Please help. Thanks so much!

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.