how do i get value which returns from service (WCF) using JQuery?
client:
$("#btn").click(function (event) {
$.getJSON('http://host/myservice.svc/GetCount?method=?', { Id: '2' }, function (customer) {
//how to get an value ??? here ????
});
//return false;
});
开发者_JAVA百科Server
public long GetCount(string method, string Id)
{
return 100;
}
Do you have jsonP endpoint which automatically converts and sends the jsonp object to the user. if jsonP you should get straightway.
If it is not jsonp end point , change your backend to a well formated string which is of jsonP notation and do a eval at the UI.
You will have some cross browsers issues also.follow the below link
http://www.west-wind.com/weblog/posts/107136.aspx
Custom jsonp binding
<endpoint address="ajax" binding="customBinding" bindingConfiguration="jsonpBinding" behaviorConfiguration="JsonBehavior" contract="InterfaceGoeshere"/>
精彩评论