title: Ajax Jquery PUT request doesn't work
body: <p>I am trying to send an Ajax PUT request using jQuery to my server but when I <code>console.log</code> the data I get back through my success function, I get the very same data I am trying to update.</p>
  
  <p>Here my Ajax request:</p>
  
  <pre><code>$(".plus-button").on("click", function() {
  
      var handler = $(this).siblings(".editIngredientForm");
  
      var formData = {
          photoName: handler.children("#numberOfItems").prevObject[0][0]["value"],
          name: handler.children("#numberOfItems").prevObject[0][1]["value"],
  
          // Add + 1 to number of items in ingredient to account for the clicking on plus sign
          number: Number(handler.children("#numberOfItems").prevObject[0][2]["value"]) + 1,
      };
  
      var actionUrl = $(this).siblings(".editIngredientForm").attr("action");
      // console.log(formData);     
  
      $.ajax({
          url: actionUrl,
          data: formData,
          type: "PUT",
          success: function(data) {
              console.log(data);
          }
      })
  });
  </code></pre>
  
  <p>And here's the backend route (Node JS) that handles updates:</p>
  
  <pre><code>app.put("/inventory/:id", isLoggedIn, function(req, res) {
      Ingredient.findByIdAndUpdate(req.params.id, req.body.item, { new: true }, function(err, updatedIngredient) {
          if (err) {
              console.log(err);
          } else {
              if (req.xhr) {
                  res.json(updatedIngredient);
              } else {
                  req.flash("success", "You successfully updated the Ingredient's info");
                  res.redirect("/inventory/" + req.params.id);
              }
          }
      })
  })
  </code></pre>
  
  <p>Does anyone know what I am doing wrong?</p>