Home>
$(function () {
    $("# button"). click (function (event) {
     var form_data = {
        id: $('# id'). val (),
        add: $('# add'). val (),
  };
      var json = JSON.stringify (form_data);
      $.ajax ({
        type: "POST",
        url: "c.php",
        data: {json},
        dataType: "json"
      }). done (function (data) {
        $("# p"). text (dat);
      }). fail (function (XMLHttpRequest, textStatus, errorThrown) {
        alert (errorThrown);
      });
    });
    });

The current code will be sent even if the form data is empty, but I want to send it only when all items are filled. How can I do that?