I've got a Node.js server listening on localhost:3000 working as a black box that outputs UI that I want to load into a local website.
The consuming service written in jQuery is:
$('.my_selector').click(function(){
$.ajax({
url: ':3000/',
method: "POST",
success: function(data) {
$("#content").append(data);
},
error: function(jqXHR, textStatus, errorThrown) {
alert('error ' + textStatus + " " + errorThrown);
}
});
});
Instead of visiting the page directly it loads content and appends it to #content
.
The issue is that the code does not work.
Edit:
If I set localhost:3000
to url
I get XMLHttpRequest Exception
:
jquery.min.js:4 XMLHttpRequest cannot load localhost:3000/. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource