Maybe it’s something simple but the below code isn’t working, the expressjs server is receiving the request and data, but the jQuery ajax call isn’t receiving the response from the server
this is the server code
app.get('/', function(req, res){
console.log('request for /');
res.send('hello there!');
});
this is the jQuery request
$.ajax({
type: 'GET',
url: 'http://localhost:3000/',
success: function(data) {
alert(data);
}
});
this is the expressjs app configurations
app.configure(function(){
app.set('port', /*process.env.PORT ||*/ 3000);
app.set('views', __dirname + '/views');
app.set('view engine', 'jade');
app.use(express.favicon());
app.use(express.logger('dev'));
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(app.router);
app.use(express.static(path.join(__dirname, 'public')));
});
EDIT: took out Json stuff, problem exists anyway
Solution was to allow cross domain headers