[英]call WCF service from javascript
I would like to call a WCF service hosted on a remote server, from javascript code withing a web page. 我想从带有网页的javascript代码中调用托管在远程服务器上的WCF服务。 I created the user interface with an external java based widgets and controls and would like to retrieve the data which will be in json format.
我使用外部基于Java的小部件和控件创建了用户界面,并希望检索json格式的数据。
var data = [
// This information, presumably, would come from a database or web service
{id: 1, value: 20000, site: 1 },
{ id: 2, value: 16000, site: 1 },
{ id: 3, value: 11000, site: 1 },
{ id: 4, value: 1800, site: 1 },
{ id: 5, value: 2600, site: 1 },
{ id: 6, value: 1900, site: 2 },
{ id: 7, value: 20000, site: 2 },
{ id: 8, value: 28000, site: 2 },
{ id: 9, value: 12000, site: 2 },
{ id: 10, value: 40000, site: 2 }
];
the json data will be assigned to this variable data and then displayed in a data grid. json数据将分配给此变量数据,然后显示在数据网格中。 If I have the url, how do I call this service?
如果我有网址,该如何调用该服务? The data would be one field "value" as such:
数据将是一个字段“值”,如下所示:
{"rules":
[
{"value":"rule1"},
{"value":"rule2"}
]
}
如果您可以使用jQuery,则使用的是哪种Java Widget,这是如何从Java Widget调用WCF服务的方法http://www.codeproject.com/Articles/132809/Calling-WCF-Services-using-jQuery
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.