The problem is in the client code. What is the client code?

On Wednesday, July 1, 2015 at 12:38:50 PM UTC-7, A wrote:
>
> HI,
>
> I have a page that is requesting data via ajax as such
>
> ....
> url = 'hello/world/123',
> method: 'get',
>
> ...
>
> The route is this
> app.get('/hello/world/:num', function(req, res) {hello.readWorld(req, res, 
> req.params.num)});
>
>
>
> Which successfully calls this
> module.exports.readWorld= function (req, res, num) {
>     world.findById(num, {'_id': 0,'Stuff' : 1}, function (err, results) { 
>        
>         if (err) res.send(err);          
>         res.type('json');
>         res.json({"data":results});
>         //res.send(results);
>     });
> }
>
>
> The above works, i get all the correct JSON
>
> *The problem is it overwrites my whole page that initiates the ajax call 
> with JSON data vs binding it to the call's response*
>
> I tried res.send(results) and a few other variations with no luck
>
> Thanks
>

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
To post to this group, send email to nodejs@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/aafe5ee2-a3c4-45de-b3b5-c57ca2452469%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to