Checkbox sends 'on' when serialized

-1

I have an html form that I send the data via ajax like this:

function showValues() {
  $.ajax({
    type: "get",
    url: "/Home/salvaItem",
    data: $("form").serialize(),
    success: function (data) {
      $("#results").text(data);
    }
  });

  return false;
}

It all happens well, however, I have 3 fields that are checkbox where I am expecting the value 1 or 0 to handle, and the same is being sent 'on' or not sending.

I have tried to do <input type="checkbox" name="delivery" checked="1"> Entrega a domicílio to see if it forces the same to send the number 1, but without success.

Any help?

    
asked by anonymous 10.01.2018 / 12:56

1 answer

0

I solved using:

<input type="checkbox" name="delivery" value="1">

    
10.01.2018 / 13:01