title: How can I send a POST request without data in Java Script
body: <p>So I am already using Ajax to send an array to the router as you could see here...</p>
  
  <pre><code> var send = function () {
              var data = search
              console.log(data)
              $.ajax({
                  type: 'post',
                  url: "/next",
                  data: JSON.stringify(data),
                  contentType: "application/json; charset=utf-8",
                  dataType: "json",
                  success: function (data) {
                      console.log('Success')
                  },
                  error: function (err) {
                      console.log(err)
                  }
              })
          }
          send();
  </code></pre>
  
  <p>If I console.log this as </p>
  
  <pre><code>console.log(req.body)
  </code></pre>
  
  <p>I get </p>
  
  <pre><code>[ 'Faye Dunaway', 'Kathy Bates' ]
  </code></pre>
  
  <p>which is fine, I need this. However, in my router I am also trying to render a new page with data in it like this....</p>
  
  <pre><code>router.post("/next", function (req, res) {
      Movies.find({name:{ $in: req.body}}, function(err, found){
          if(err){
              console.log(err)
          } else {
              res.render('movies',{
                  movies:found
              })
          }
      })
  })
  </code></pre>
  
  <p>Now I have been told that I can not call res.render with  ajax so I needed to make a button inside a form. </p>
  
  <pre><code>&lt;form action="/next" method="post"&gt;
      &lt;button  class="btn btn-outline-success btn-lg next"&gt;next&lt;/button&gt;
   &lt;/form&gt; 
  </code></pre>
  
  <p>However, if I console.log req.body now i get</p>
  
  <pre><code>[ 'Faye Dunaway', 'Kathy Bates' ]
  {}
  </code></pre>
  
  <p>So I am thinking 2 things, either res.render has to be called with ajax or I need to get rid of the {}. As you can tell I am new to this. Thank your for your help. Ask for any additional information.</p>