1
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<form id="form1">
<div class="jumbotron">
<input type="text" id="codUser"/>
<button onclick="ConsUsuario(); return false;">Consulta Usuario</button>
</div>
</form>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
function ConsUsuario(){
var value = $("#codUser").val();
$.ajax({
url: "http:/food-fast-com.web27.redehost.net/ServiceUsuario.svc/ConsultarRegistroPorCodigo",
type: "GET",
data: JSON.stringify(value),
dataType: "json",
contentType: "application/json",
success: function (result) {
console.info(result);
}
});
}
</script>
of the error Failed to load resource: the server responded with a status of 404
, as if it did not find the webservice path, but in soapUI it works blz.
Try using the script this way by changing its parameter passage to the URL.
function ConsUsuario(){
 var value = $("#codUser").val();

 $.ajax({
 url: "http://food-fast-com.web27.redehost.net/ServiceUsuario.svc/ConsultarRegistroPorCodigo/" + value,
 type: "GET",
 dataType: "json",
 contentType: "application/json",
 success: function (result) {
 console.info(result);
 }
 });
 }
– Leandro Araujo
Leandro worked, however it presented another message 'Method not alowed', but in the header it is correct:
– Gleyson Silva
Leandro did not give error however the return of the console was : 'Object {Query {"Consultationregister":{"Code":2,"Code":1,"Login":"ednilson1","Name":"Ednilson","Registration":true,"Password":"123456","Type":"D"}}, I saw that the server is not allowed to (*), so I tested on localhost by the browser with the URL: http://localhost/Servicerestpub/Serviceusuario.svc/Consultarregistroporcodigo/2 which is permitted for all methods
– Gleyson Silva
Well, the return of your webservice is correct. Now you just need to use your object, I believe within your method Success you can access the returned object by following the example:
success: function (result){alert(result.ConsultarRegistroPorCodigoResult.Codigo);}
– Leandro Araujo
worked @Leandroaraujo, thanks friend for the help!
– Gleyson Silva