2
I’d like some help, wanted to do an IF to disable or enable a field that comes with the value 1 or 0.
$(document).ready(function () {
$("#btnProduto").click(function () {
$.ajax({
type: "POST",
url: "Selecionar",
data: { id_produto: $("#ListaProdutos").val() },
success: function (mensagem) {
//alert(mensaje);
//$("#idproducto").val(mensaje.Nombre);
$(mensagem).each(function (index, item) {
//recibir datos json
$("#descricao").val(item.descricao),
$("#id_produto").val(item.id_produto)
$("#pvenda").val(item.pvenda)
});
}
});
});
});
my field that I want to block or unlock is the $("#pvenda").val(item.pvenda)
, this field will return me only 2 values, 1 or 0, if it is 0 I want to disable the field for the user not edit it, and if it is 1 I want the field to be enabled for the user to inform the value you want.
Thanks in advance !!
Alysson you are getting the values right in ajax?
– Leonardo Bonetti
The weird thing is you get
$("#pvenda").val(item.pvenda)
, a JSON does not offer data that way.– Leonardo Bonetti
to @Leonardobonetti, ta bringing the right value
– Alysson bormann