I am using apache httpd server to host client files
http:
and my Nodejs server is running on http://ipaddress:8087
when i send a mail request then it shows the following error
XMLHttpRequest cannot load http://ipaddress:8010/. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://ipaddress:8087' is therefore not allowed access.
my client side code:
$.ajax({ type: "POST", url: "http://ipaddress:8010", data: {name:"xyz"}, success: function(){ alert("success"); }, dataType: "json" });
my server side:
response.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS, PUT, PATCH, DELETE'); response.setHeader('Access-Control-Allow-Headers', 'X-Requested-With,content-type'); response.setHeader('Access-Control-Allow-Credentials', true);
options are allowed, but it does not work, can someone tell me what the problem is? I am receiving a server side request but cannot send any response.
early:)
Rahul source share