title: Nodejs - Ajax delete method in using mongodb seems to work fine (no errors) but it's not working
body: <p>Good day all!
  I have an ajax method that sends data to the backend and the backend does operations with the data base (Rest API I think it's called).
  The problem is, even thought I have no errors on frontend or backend, the operation I'm trying to complete doesn't take place. Hope you can help, thanks in advance.</p>
  
  <pre><code>//Front-end (jQuery ajax)
  
  
      $(document).on('click', '.remove-product', function () {
          //Get the ID variable inside the element we press
          var idEl = $(this).closest('.item-box');
          var id = idEl.find('.product-id').text();
          console.log(id);
  
          $.ajax({
              type:'DELETE',
              url: '/dashboard/:' + id,
              success: ajaxMessaging('green', 'Deleted a record')
          });
      });
  
  //Backend
  router.delete('/dashboard/:id', (req, res)=&gt;{
  
      idStr = req.params.id;
      id = idStr.replace(":", "");    //Because : is sent through ajax
      console.log(id);
  
      User.deleteOne({_id : mongoose.Types.ObjectId(id)}, (err)=&gt;{
          if(err) console.log(err);
  
      });
  });
  </code></pre>
  
  <p>Please note that I'm trying to delete an array index, but since every element has a unique id (right?) I'm trying to delete the index by id.</p>