heroku javascript ajax post not returning anything -
i'm trying ajax post heroku server app , have app return response client web page (on different server).
it works fine if test locally (using localhost) when push heroku, no response.
app.js:
var express = require('express'); var app = express(); app.use(express.bodyparser()).post('/', function(req, res){ res.header("access-control-allow-origin", "*").header("access-control-allow-headers", "x-requested-with").header('access-control-allow-methods: post, get, options'); res.end("test"); }); port = process.env.port || 3000; app.listen(port);
client-side js:
$.post("http://myapp-name-here.heroku.com", {query: "anything", val: "something"}, function(data){ console.log(data); });
edited in:
when open client-side html page, when makes post request, gets status "canceled" after couple of seconds. ideas?
myapp-name-here.heroku.com
no longer supported, try myapp-name-here.herokuapp.com
Comments
Post a Comment