I call (Ajax request) the WCF REST service, and the request is a cross-domain request.
If I breed my service in the same domain, everything works like a cream. Ultimately, during production, the service will be in a different domain.
I am using jQuery 1.5.2. My service returns me an error message:
errorThrown: "jQuery15208493315000087023_1334089616458 was not called" textStatus: "parsererror"
Although in Firefox I can see JSON values, but execution falls on the Ajax request error handler.
My Ajax request:
function CallService() { $.ajax({ type: "GET", url: "http://SomeService/EmpService.svc/GetValues?dv=1455", contentType: "application/json; charset=utf-8", dataType: "jsonp", processdata: false, success: function (data) { ServiceSucceeded(data); }, error: function (jqXHR, textStatus, errorThrown) { debugger; alert("Service Error"); ServiceFailed(jqXHR, textStatus, errorThrown); } }); }
On the WCF service side, I configured CrossDomainScriptAccess to true:
<webHttpBinding> <binding name="webHttpBindingWithJsonP" crossDomainScriptAccessEnabled="true" /> </webHttpBinding>
The JSON response I get from the server:
[{"Message": "Stop On Duty", "MessageTime": "\/Date(1334068773893-0500)\/"}, {"Message": "Start On Duty", "MessageTime": "\/Date(1334068763540-0500)\/"}, {"Message": "App_testing_4102012924am", "MessageTime": "\/Date(1334068533627-0500)\/"}, {"Message": "Kunal_testing_4102012924am", "MessageTime": "\/Date(1334067945510-0500)\/"}, {"Message": "Alert: Door Open", "MessageTime": "\/Date(1334066280963-0500)\/"}]
I donβt see anything here in the settings. All code works fine if the service is moved to the same domain.
I looked at a similar post, but could not do the job.