title: How to use res.send() in Node.js
body: <p>I am using mongoose api with a Node.js/Express application. I have a get request on the client side that asks for some data, but for some reason that data never makes it to the client side. What is wrong?</p>
  
  <p><strong>Snippet of backend</strong></p>
  
  <pre><code>app.get('/up', isLoggedIn, function(req,res){
      req.user.local.level = 2;
      req.user.save(function(err){
          res.send(req.user.local.level);
      });
  
  });
  </code></pre>
  
  <p><strong>Snippet of Frontend</strong></p>
  
  <pre><code>function try(){
      var ks=1;
      if(true){
              $.get('/up', function(data){
                  ks=data;    
              });
          }
          console.log(ks);
      }
  </code></pre>
  
  <p>The server console displays 2, yet the browser console still displays 1, What  is wrong?</p>
  
  <p><strong>Edit</strong>
  <br>
  I took your advice but it still wont work. What am i doing wrong?</p>
  
  <pre><code>var ks=1;
  if(true){
      jQuery.ajax({
           url:    '/up' ,
           async:   false,
           success: function(data) {
                      ks = data;
                      console.log(ks);
                    }
  
      });
      }
  </code></pre>