HI i have made the changes but still dont seem to find the solution.Below
are the changed codes, looks like server is not sending response to the
ajax call.
server.js
getDestinationCities: function getDestinationCities(req, res, next){
console.log('source city id ' + req.body.selectsourcecity);
rest.get('http://ec2-54-251-114-65.ap-southeast-1.compute.amazonaws.com:8080/CTB-WS/rest/cities/sourceDestinationPairs').on('complete',
function (destinationCities) {
if (destinationCities instanceof Error) {
console.log('Error:', destinationCities.message);
} else {
req.destinationCities = destinationCities;
var sourceCitiesId = req.body.selectsourcecity;
console.log('destination ' +
JSON.stringify(destinationCities[sourceCitiesId]));
res.json(JSON.stringify(destinationCities[sourceCitiesId]));
//res.json(destinationCities);
next();
}
});
}
script
$('#selectsourcecity').change(function() {
var data = "";
console.log('value ' + $(this).val());
$.ajax({
type:"POST",
url : "/booking/getdestination",
dataType: "json",
data : {selectsourcecity : $(this).val()},
async: false,
success : function(response) {
console.log('inside success');
data = response;
console.log('success ' + JSON.stringify(response));
},
error: function() {
alert('Error occured');
}
});
});
Please hlep me, i have been stuck on this for just too long, my boss doesnt
see happy with this. Learning at my own pace
--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.