vbNewbie
vbNewbie

Reputation: 3345

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. 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.

 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. 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"}
]
}

Upvotes: 2

Views: 1843

Answers (1)

bhupendra patel
bhupendra patel

Reputation: 3179

What sort of Java Widgets are using, if you can use jQuery here is how you can call the WCF service from your Java widget http://www.codeproject.com/Articles/132809/Calling-WCF-Services-using-jQuery

Upvotes: 1

Related Questions