Calling web service via Ajax with focusout function

Asked

Viewed 185 times

0

 $("#<%=txtProduto.ClientID%>").on("focusout", function (event) {
            event.preventDefault();
            $.post(AjaxService.Pessoa(<%=txtProduto.ClientID%>), function (data) {
                $("#<%=txtPrecoUnitario.ClientID%>").val(data);
            });

        });

I’m trying to call web service service via Ajax, and this has parameters and should return me a value too.

The code above is what I tried but it doesn’t work.

  • Do you want to call a Webservice? You use C#?

  • yes it is in c#.. this is a web service

  • I’ll assume you’re using a Webmethod, try removing $.post and passing the callback function as the second parameter of the AJAX method: Ajaxservice.Person(<%=txtProduct.Clientid%>, Function(result) { ... });

  • You use asmx or WCF?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.