title: Hide div after click of button with mysql
body: <p>I want to hide a 'div' after a button is clicked. I don't want to use .remove() because when you refresh the app it comes back. I have the information about this div on the database and I wanna work with it.</p>
  
  <p>I tried already creating an Ajax call to select the information that I'm looking at and then on the front-end I'm telling if it exist then delete it. But I feel like I'm missing something and I don't know why.</p>
  
  <p>Frontend:</p>
  
  <pre><code>$('#deletePromo').on('click', function(res){
      let success = function(res){
          if (eventName &amp;&amp; customerID){
              $(`#promotion-container .promo${i}`).remove();
          }
      }
  
      $.ajax({
              type: 'POST',
              url: '/api/promotions-done',
              crossDomain: true,
              //success: success,
              dataType: 'json',
              data: {
                  customerID : customerID,
                  eventName : eventName,
              }
          }).done(function(res){
              console.log('res', res)
              if (res != null){
                  $(`#promotion-container .promo${i}`).remove();
                  //$(`#promotion-container .promo${i}`).css('display', 'none')
              }
          })
          })
  })
  </code></pre>
  
  <p>Backend:</p>
  
  <pre><code>router.post('/promotions-done', function(req, res) {
    let customerID = req.user.customer_id
    let restaurantGroupId = req.user.restaurant_group_id
    let eventName = req.body.eventName
  
    db.task(t =&gt; {
        return t.any(`SELECT * FROM promotions_redemption WHERE (customer_id = '${customerID}' AND event_name = '${eventName}' AND restaurant_group_id = ${restaurantGroupId})`).then(function(promotionsDone) {
          return res.json({'promotionsDone': promotionsDone})
        })
        .catch((err) =&gt;{
          console.log(err)
        })
      })
  })
  </code></pre>
  
  <p>What I'm trying to do here is saying if the customerID and eventName already exist on the table then remove div from the person. I don't have much experience working with backend so is there a way to tell the program to check the database for this information and if it exists then remove the div.</p>