title: How to read values sent in Xmlhttprequest POST request on my express backend in Nodejs?
body: <p>I want to send the values of <strong>candid</strong> and <strong>candidresults</strong> to my <strong>/savevote</strong> route in my express backend. How can i do that properly.</p>
  
  <pre><code>var candid;
  var candidresults;                                                                                                   
  
   var xhr = new XMLHttpRequest();
  
  xhr.open('POST', 'savevote', true);
  xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
  xhr.onload = function () {
  
          contractInstance.voteForCandidate(candidateName, {
        from: web3.eth.accounts[0]
      }, function () {
        console.log(contractInstance.totalVotesFor(candidateName).toString());
  
  
        candid = candidateName;
        candidresults = contractInstance.totalVotesFor(candidateName).toString();
  
      console.log(this.responseText);
  };
  xhr.send(candid);
  xhr.send(candidresults);
  }
  
  
  </code></pre>
  
  <p>Also,how do i access these values from my <strong>/savevote</strong> route that i've created below in my Express backend as shown below</p>
  
  <pre><code>router.post('/savevote', function (req, res, next) {
  
  
  });
  </code></pre>