I am trying to run a basic Ajax call using JQuery on the client and node.js on the server. the client is loaded from the same server as the one handling the Ajax request - yet i receive on the client side this error:
"XMLHttpRequest cannot load .... No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin ...... is therefore not allowed access."
I think that the same origin policy surely isn't violated here? maybe local host is treated differently?
server:
httpListen.createServer(function (req, res) {
....
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('_testcb(\'{"message": "Hello world!"}\')');
}
client:
$.ajax({
        url: "http://127.0.0.1:1337/",
        data : {formType:"ajaxTest", key1:"val1", key2:"vall2"},
        formType:"ajaxTest",
        jsonpCallback: "_testcb",
        cache: false,
        timeout: 5000,
        success: function(data) {
                    $("#textBox").text("replied");
                },
        error: function(jqXHR, textStatus, errorThrown) {
                    alert('error ' + textStatus + " " + errorThrown);
                }
        });
this is written after the guidelines of the 1st reply here: how to use jQuery ajax calls with node.js, but i am still getting the said error.
edit: found the problem: using localhost instead of 127.0.0.1, works fine...