хм,
добавил console.log
http.createServer(function (req, res){
console.log("1");// тут
if(req.url == '/vote'){
res.writeHead(200, {'Content-Type': 'text/plain;'});
var now = new Date();
var timeStr = now.getHours() + ':' + now.getMinutes() + ':'+now.getSeconds();
res.end('Голос принят: ' + timeStr);
}
else{
res.writeHead(200, {'Content-Type': 'text/plain; charset=utf-8'});
res.end('Hello World!');
}
}).listen(8080, '127.0.0.1');
и при нажатие на кнопку в консоль выводит 1 , значит запрос все таки отправляется, но ошиба все равно осталась
Цитата:
|
XMLHttpRequest cannot load http://127.0.0.1:8080/. Origin null is not allowed by Access-Control-Allow-Origin.
|