The following script works in part:
<script type="text/javascript">
function ConsUsuario(){
var value = $("#codUser").val();
$.ajax({
type: "GET",
url: "ServiceRestPub/ServiceUsuario.svc/ConsultarRegistroPorCodigo/" + value,
contentType: "application/json",
dataType: "json",
success: function (result) {
alert(result.ConsultarRegistroPorCodigoResult.Nome);
debugger;
var tabela = $("#datagrid");
var rows = "";
tabela.find("tbody td").remove();
var jArrayObject = result;
for (var i = 0; i < result.length; i++) {
var obj = result[i];
alert(obj.Login);
rows += "<tr>";
rows += " <td>" + obj.Codigo + "</td>";
rows += " <td>" + obj.Login + "</td>";
rows += " <td>" + obj.Nome+ "</td>";
rows += " <td> <input type='checkbox' /> </td>";
rows += "</tr>";
}
// tabela.find("tbody").html(rows);
tabela.html('<tbody>' + rows + '</tbody>');
//console.info(result.d);
}
});
}
</script>
When I get to the line for (var i = 0; i