Sending XMLHttpRequest from SideBar

Hello,

I’m working on a web extensions and facing a problem which I can’t figure out. The extension will have a sidebar. In this sidebar I need to show some content which is provided by a web service (running on localhost:8080) at the moment. The problem it looks like the request is send (no error is reported) but no request is send. The JavaScript file is included into the sidebar in the usually way:

<script src="sidebar.js"></script>

at the end of the HTML file for the sidebar. Other parts of the script work. The XMLHttpRequest is created in this way:

var request = new XMLHttpRequest();
request.open("GET", "localhost:8080/service/");
request.addEventListener('load', function (event) {
    console.log("Processing response...")
    if (request.status >= 200 && request.status < 300) {
        console.log(request.responseText);
    } else {
        console.log("Error: " + request.status);
    }
});
request.send();

In the manifest.json the following permissions are definied:

"permissions": [
    "*://localhost/*",
    "activeTab",
    "tabs",
    "storage"
],

From what I read in the documentation it should work. What am I missing?

Best regards

Jens

Try
request.open("GET", "http://127.0.0.1:8080/service/");

or
request.open("GET", "http://localhost:8080/service/");

Thanks. That was not real problem, but after I check the URL in my extension via the debugger I found out that the URL was missing a slash. Thanks for pointing me into the right direction.