I have a script that the user enter the ID, the fields are completed: name and inactive, if the user has marked the checkbox inactive when registering return the filled checkbox and if he has not checked the checkbox return it without checked, however my function always returns the filled checkbox
<script type='text/javascript'>
$(document).ready(function(){
$("input[name='id']").blur(function(){
var $nome = $("input[name='nome']");
var $inativo = $("input[name='inativo']");
$.getJSON('function_pes.php',{
id: $( this ).val()
},function( json ){
$nome.val( json.nome );
$inativo.prop('checked', json.inativo );
});
});
});