Passing parameters to WCF function from JavaScript
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
精彩评论