开发者

What is the best choice for making AJAX calls to a WCF service?

The Microsoft AJAX Library Preview 6 and jQuery provide several ways to make the sorts of calls I need:

  • Sys.Net.WebRequest (ASP.NET Ajax)
  • Sys.Net.WebServiceProxy (ASP.NET Ajax)
  • $.ajax (jQuery)

Sys.Net.WebRequest offers a way to specify the verb ("GET", "POST", "PUT", and "DELETE"), but no built-in callback for a failed request (they all seem to use the same callback, success or fail).

Sys.Net.WebServiceProxy seems to only开发者_运维问答 do "GET"/"POST" (via the "useGet" parameter on the invoke method). There are callbacks for both success and failure.

$.ajax offers a way to specify the verb, has both success/failure callbacks, and can specify timeout length (among other things).

From the standpoints of maintainability, reliability, and usability, which of these would be the best method to standardize on when making AJAX calls to a WCF service (which returns JSON results)?

jQuery seems to do everything I want, but I could be missing something with the MicrosoftAjax library (as it's so big...). If I'm missing anything, or don't have my facts right, let me know!

Thanks!


I have to say, go with jQuery - not only does it do everything you need, but it is going to be more common than MicrosoftAjax because it is being used outside of Microsoft technologies. Part of maintainability is using frameworks that are in common use and jQuery is exactly that.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜