How to insert node js script in a html file
<p>I have started a POST server using node Js. I want to access the POST service through html file.</p>

<pre><code>&lt;html&gt;
   &lt;body&gt;

&lt;script type="text/javascript"&gt;  
function PostMethod(){  
var http = require('http');

//The url we want is: 'www.random.org/integers/?num=1&amp;min=1&amp;max=10&amp;col=1&amp;base=10&amp;format=plain&amp;rnd=new'
var options = {
  host: 'localhost',
  port:8081,
  path: '/',
 method: 'POST'
};

callback = function(response) {
  var str = '';

  //another chunk of data has been recieved, so append it to `str`
  response.on('data', function (chunk) {
    str += chunk;
  });

  //the whole response has been recieved, so we just print it out here
  response.on('end', function () {
    alert(str);
  });
}

http.request(options, callback).end();
}  
&lt;/script&gt;  
&lt;form&gt;  
Enter No:&lt;input type="text" id="number" name="number"/&gt;&lt;br/&gt;  
&lt;input type="button" value="click" onclick="PostMethod()"/&gt;  
&lt;/form&gt;

   &lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>This is not working. But iF I seperatly run the script in node js, the post reply I am getting</p>