I'm using a WCF jQuery AJAX Call Sample which I have downloaded. I can run this and make it work in the same project. When I access the same from a different project in the same solution, it does nothing. The following is the method I'm calling.
function WCFJSON() {
var parameter = "1234567890 (Cross Domain)";
Type = "GET";
Url = "http://localhost:52729/jQueryWebSite/Service.svc/Test?Id=" + parameter;
Data = '{"Id": "' + parameter + '"}';
ContentType = "application/json; charset=utf-8";
DataType = "jsonp"; ProcessData = false;
CallService();
}
$(document).ready(function () {
WCFJSON();
});
I have alert()'s in Success and Failure methods.
When I run the URL directly in the browser, it returns me the result. But if I run this from a different project, it does nothing. No alerts, No results.
Following is my Web.Config of the Project Where my Service is running;
<?xml version="1.0"?>
<configuration>
<appSettings/>
<connectionStrings/>
<system.web>
<compilation debug="true">
<assemblies>
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/></assemblies>
</compilation>
<authentication mode="Windows"/>
</system.web>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<providerOption name="CompilerVersion" value="v3.5"/>
<providerOption name="WarnAsError" value="false"/>
</compiler>
</compilers>
</system.codedom>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="EndpBehavior">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="ServiceBehavior" name="Service">
<endpoint address="" binding="webHttpBinding" contract="IService" behaviorConfiguration="EndpBehavior"/>
</service>
</services>
</system.serviceModel>
</configuration>
Is there something to do with Web.config or anything wrong in the script? I have followed many methods and tried out various ways.