Component return code: 0x805e0006 error

The following JQuery call get

:

var doc_root = document.location.hostname + ":8082";
var fw_script = doc_root + "/sites/MyScripts/fw2.php";
var langpref = "EN";

var ttype = "BEGIN";
var vvalue = $("#inp_begin").val();

$.get(fw_script, { type: ttype, value: vvalue, langpref: langpref })
    .success(function(result) {
        $(fw_result).text(result);
        alert("Success");
    })
    .error(function(jqXHR, textStatus, errorThrown) {
        $(fw_result).text("Error: " + textStatus + " " + errorThrown);
        alert("Failure");
    });

      

generates the following error message (called .error

):

Error: error [Exception... "Component returned failure code: 0x805e0006
[nsIXMLHttpRequest.open]" nsresult: "0x805e0006 (<unknown>)" location: "JS frame ::
http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js
:: <TOP_LEVEL> :: line 4" data: no]

      

I have no idea what this post is and I can't find much explanation with my Googling. Can anyone clarify?

UPDATE

The url being called is built in Javascript like this:

var doc_root = document.location.hostname + ":8082";
var fw_script = doc_root + "/sites/MyScripts/fw2.php";

      

and fw_script

:

fw.localhost:8082/sites/MyScripts/fw2.php

      

It is called from

fw.localhost:8082/en

      

When I try to use fw.localhost:8082/sites/MyScripts/fw2.php

in my browser it is successful.

+3


source to share


2 answers


It looks like you are dealing with a cross-domain request request error. According to the Same Origin Policy , you cannot make an AJAX request to a host with a different port number, even if it is the same domain. It looks like you are setting doc_root

to a different origin by this definition, so you will most likely get an error in the AJAX request.

Standard parameters for this:



  • Serve your data from the same host you are making the request from.

  • Use JSONP instead of JSON.

+9


source


Just to take notice of the spies done by @nrabinowitz and other commenters: check out your ad blocker / privacy plugin . In my case, Privacy Badger started blocking localhost

.



+1


source







All Articles