title: How to send a POST request from a function in my Frontend JS file in my NodeJS web app?
body: <p>Lets say i have two variables in my NodeJS front end <strong>Example.js</strong> file:</p>
  
  <pre><code>var a;
  var b;
  
  function senddata() {
  
         a = "Hassan";
         b = 7;
  
    }
  return true;
  </code></pre>
  
  <p>Now what i'd like to do is send these two variables to my server using a <strong>POST</strong> request. At the backend i'm using ExpressJS for my routes.</p>
  
  <p>In my <strong>Routes.js</strong>(At the backend) i want to receive the values of a and b through a <strong>POST</strong> request from my <strong>senddata()</strong> function.</p>
  
  <p>In my routes i have created this route for the data:</p>
  
  <pre><code>router.post('/save', function (req, res, next) {
  
  
  //Sending values of a and b to my database
  
  
  
  
  
  });
  </code></pre>