iwent to run this simple wcf method using ajax in html page as test but it doesn't run at all and idont know whats the problem
![error message][1]
IcustomerService page
[OperationContract] [WebInvoke(Method = "POST", ResponseFormat = WebMessageFormat.Json)] string GetTEST();
service.svc page
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] public class Service1 : IcustomerService { public string GetTEST() { return "OKKKKKKKK"; }
here is my html page
> > <title></title> > <script type="text/javascript"></script> > <script type="text/javascript"src="Scripts/jquery-2.1.1.min.js"></script> > <script type="text/javascript" src="Scripts/jquery-2.1.1.intellisense.js"></script> > <script type="text/javascript" src="Scripts/jquery-2.1.1.js"></script> > <script type="text/javascript" src="Scripts/jquery.unobtrusive-ajax.js"></script> > <script type="text/javascript" src="Scripts/jquery.unobtrusive-ajax.min.js"></script> > > > <script type="text/javascript"> > var url = 'http://localhost:43315/Service1.svc/' > > function GetProducts() { > > var response; > > $.ajax({ > async: true, > type: 'post', > url: url + 'GetTEST', > contentType: 'application/json; charset=utf-8', > dataType: 'json', > success: function () { > alert("yahooooooooo"); > }, > > error: function (e) { > alert("Error : " + e.statusText); > } > }); > } > >
here is web.config page
<system.serviceModel> <behaviors> <serviceBehaviors> <behavior name="Service1Behavior"> <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/> <serviceDebug includeExceptionDetailInFaults="true"/> </behavior> </serviceBehaviors> <endpointBehaviors> <behavior name="WebBehavior"> <enableWebScript/> </behavior> </endpointBehaviors> </behaviors> <services> <service behaviorConfiguration="Service1Behavior" name="WcfService1.Service1"> <endpoint address="" binding="basicHttpBinding" contract="WcfService1.IService1" /> <endpoint address="Web" binding="webHttpBinding" contract="WcfService1.IService1" behaviorConfiguration="WebBehavior" /> </service> </services> <protocolMapping> <add binding="basicHttpsBinding" scheme="https" /> </protocolMapping> <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" /> </system.serviceModel>