Problems with WCF jquery Domain Data Services

I created a WCF data service in a new asp.net web application and I want to call this web service from another web application using jquery, but it always returns null.

My jquery query is as follows:

$.ajax({ type: "GET", url: "http://localhost:2916/PennyBridge.svc/Member", data: "{}", contentType: "application/json; charset=utf-8", dataType: "json", success: function (data) { }, error: function (xhr) { alert(xhr.responseText); } }); 

Note that "http: // localhost: 2916 / PennyBridge.svc / Member" works in the browser, but since the jquery call comes from localhost: 3410, I assume this is a cross-domain problem.

I read that I have to use jsonp for this, but it's hard for me to understand it.

What do i need to use jsonp? Do I need to configure my WCF data service?

+4
source share
2 answers

output your wcf as a jsonp user binding and follow this link to fix the cross domain problem.

you need to download these classes from microsoft

 http://jasonkelly.net/2009/05/using-jquery-jsonp-for-cross-domain-ajax-with-wcf-services/ 
+3
source

I was in your shoes a few weeks ago, and here is the solution :

0
source

All Articles