title: AJAX request in React JS js doesn't work
body: <p>I'm trying to get info from my database via an AJAX request, but the success event isn't triggered.</p>
  
  <p>The AJAX request is however received by the server, as it trigger the correct console log in the terminal.</p>
  
  <p>I'm building it in Node, using the Express framework.</p>
  
  <p>Here is the code for triggering the AJAX call. The 'componentDidMount triggered' is logged to the console. But then it stops. Neither the console.log in 'success' or 'error' is triggered, even though I know that the server has rece<code>enter code here</code>ived an AJAX request.</p>
  
  <pre><code>app.get('/api/:name', function (req,res){
      name = req.params.name;
      Member.findOne({username: name}, function(err,member){
          res.setHeader('Content-Type', 'application/json');
          res.write(member.toString());
          console.log('member fetched from DB: ', member);
          res.end();
      });
  });
  </code></pre>
  
  <p>I'm not getting any other errors either, so I have no idea why this isn't working.</p>
  
  <p>Can anybody please help?</p>
  
  <p>UPDATE: Thanks for the help. I'm one step closer now. I did not realise I needed 'res.end' when serving the AJAX request. When I changed this, I've managed to get a response, though it's an error.</p>
  
  <p>Her is the server side code:</p>
  
  <pre><code>app.get('/api/:name', function (req,res){
      name = req.params.name;
      Member.findOne({username: name}, function(err,member){
          res.setHeader('Content-Type', 'application/json');
          res.write(member.toString());
          console.log('member fetched from DB: ', member);
          res.end();
      });
  });
  </code></pre>