Consume WCF Json Service with JQuery -
before start: i've read posts consuming wcf json service jquery - no results.
i have wcf json service link works fine. can retrive data in android app, assume wcf's part not problem. script looks like:
function btn() { $.ajax({ url: "http://amder.pl/wcftest.svc/getpracownicy", type: "get", processdata: true, contenttype: "application/json", timeout: 10000, datatype: "json", success: function (response) { alert(response); }, }); };
it doesn't work. spent on 2 hours searching solution, tried dozens scripts... now, ask help, please spare me comments "use google ..." etc.
here web.config service part:
<system.servicemodel> <behaviors> <servicebehaviors> <behavior name=""> <servicemetadata httpgetenabled="true" httpsgetenabled="true" /> <servicedebug includeexceptiondetailinfaults="false" /> </behavior> </servicebehaviors> </behaviors> <services> <service name="amder_01.wcftest"> <endpoint contract="amder_01.iwcftest" kind="webhttpendpoint" /> </service> </services> <servicehostingenvironment aspnetcompatibilityenabled="true" multiplesitebindingsenabled="true" />
most of based on stackoverflow.
you need configure basic http end point wcf service. need have similar below in config file
<service name="helloworld, indigoconfig, version=2.0.0.0, culture=neutral, publickeytoken=null"> <endpoint address="/helloworld2/" contract="helloworld, indigoconfig, version=2.0.0.0, culture=neutral, publickeytoken=null" binding="basichttpbinding" /> </endpoint> </service> <bindings> <basichttpbinding receivetimeout="00:00:01" /> </bindings>
Comments
Post a Comment