开发者

Passing parameters to WCF function from JavaScript

开发者 https://www.devze.com 2023-03-05 00:02 出处:网络
I have a WCF function 开发者_JAVA百科that takes a complex type as its input parameter. How do you I create and pass this complex type (object with properties) through the call?

I have a WCF function 开发者_JAVA百科that takes a complex type as its input parameter. How do you I create and pass this complex type (object with properties) through the call?

Thanks


There are two ways to accomplish your task. You can use the ASP.NET ScriptManager and have it create a JavaScript proxy to the WCF service or you can use jQuery's ajax functionality to do it too. I've included links to both examples below.

Using jQuery/ajax: http://www.west-wind.com/weblog/posts/2008/Apr/21/jQuery-AJAX-calls-to-a-WCF-REST-Service

Using ScriptManager JS proxy: http://blogs.msdn.com/b/kaevans/archive/2007/09/04/using-wcf-json-linq-and-ajax-passing-complex-types-to-wcf-services-with-json-encoding.aspx

0

精彩评论

暂无评论...
验证码 换一张
取 消