title: How do I send and receive a string using ajax and express.js?
body: <p>I need to send a string to a function on the server. Then send a string to the client after the server function is done.</p>
  
  <p>cleint</p>
  
  <pre><code>$.ajax({
      type: 'POST',
      url: 'http://localhost:1337/text',
      data: { q:document.getElementById("text").value},
      success: function (response) {
  
      },
      error: function () {
  
      }
  });
  </code></pre>
  
  <p>server</p>
  
  <pre><code> app.post('/text', function(req, res) {
     console.log(data.q);
   });
   app.listen(1337);
  </code></pre>
  
  <p>This returns this error on client </p>
  
  <pre><code>XMLHttpRequest cannot load http://localhost:1337/text. No Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access. The response had HTTP status code 404.
  </code></pre>
  
  <p>Why does this not log the text to the terminal and how do I send a string back to the success function?</p>