title: Fetch terminal command (Nodejs) and send to specific port via AJAX
body: <p>I'm actually working on a little application. I have one server written in C which is listening on the port 5260. In the other side I have a NodeJS client which is listening on the port 7777. A HTML page can be reach via this port. In the HTML page I have a simple button.
  When I click on this one a message is sent to my NodeJS server and is written on the terminal. Now I would like to fetch this command and send it to my C server which is still running and waiting for a request. </p>
  
  <p>My client.js :</p>
  
  <pre><code>var http = require('http');
  var ejs = require('ejs');
  var express=require('express');
  
  var app = express();
  
  app.engine('html', ejs.renderFile);
  
  app.set('/', __dirname);
  
  app.get('/', function(request,response) {
  
    response.render('index.ejs.html');
  })
  
  var options = {
    host: '192.168.1.154',
    path: '/',
    port: '5260',
    method: 'POST'
  };
  
  app.post('/play', function(req, res){
    var res = http.request(options);
    console.log("START_BG;BG1\n");
  });
  
  app.listen(7777);
  </code></pre>
  
  <p>And my HTML file :</p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;
          &lt;script type="text/javascript" src="client.js"&gt;&lt;/script&gt;
  
          &lt;script type="text/javascript"&gt;
  
          function sendMessage() {    
              var xhr = new XMLHttpRequest();
              xhr.open('POST', '/play', true);
              xhr.onload = function() {
               console.log(xhr);
              };
              xhr.send();
          }
  
        &lt;/script&gt;
      &lt;/head&gt;
  &lt;body&gt;
  
  &lt;button onclick="sendMessage()"&gt;VIDEO&lt;/button&gt;
  
  &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>