title: How to send and receive HTTP requests in javascript
body: <p>I am trying to send HTTP requests from client side javascript and display all the response neatly in HTML(headers, content, additional text etc).</p>
  
  <p>In addition to this I also want to code javascript that sends a particular response when someone visits the web page. For example, if I want to send the 402(payment required) when someone visits example.com/test, how do I do it in client side javascript?</p>