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!

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.