On the client side, I have an GET Request with jquery as below
$.getJSON(serviceUrl + '?callback=?', callback);
And on the nodejs server side, my code handle the request looks below:
module.exports.generateCallback = function(request, data) {
var response = JSON.stringfy(data);
if (request.params.callback) {
response = request.params.callback + '(' + response + ')';
}
return response;};
I logged the response on the server before it was return to client, it looks ok like below
jQuery1102068707_1411004666493({"success":true,"profile":{"id": 123, "name: owen"}})
but when the above result sent back to client the result somehow is incompleted like below
jQuery1102068707_1411004666493({"success":true,"profile":{"id": 123, "name: owen
then I have an error as the result is not valid.
I couldn't figure out happen and why the result on the client side is not completed, please help.
Thanks in advance.