I have an ajax get request as below. I am making a GET request to server.js in openshift using nodejs express. However, i get html contents in the response method instead of
res.send(names)
is not JSON, You have to stringify the data using JSON.stringify
.
Try testing before the DB call to check if it works.
res.send( JSON.stringify( {testData:'test'} ) )
Edit
As discussed in the comments, please check to ensure that your request is routed to the correct route that you declared.
Does console.log("gat method");
output anything to the terminal window?