asdsd asdsd - 1 year ago 91
Ajax Question

Client receive json object to javascript

I want my server to send a JSON object to a javascript on the client's side. How can the client get the object into his javascript and not show the object on screen?

In my server :

app.get('/', function (req, res) {

Thank you!

Answer Source

Using jquery i will show you a quick example of how things work:


$.get('', {mydata: 'content'}, function(response){
   //callback triggered when server responds


app.get('/', function (req, res) {
  if(req.params.mydata === 'content'){
    res.end("you sent content");
  }  else {
    res.end("you sent something else");

Do you understand what i mean?

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download