jQuery vs MicrosoftAjax in ASP.NET MVC

前端 未结 4 1642
不知归路
不知归路 2021-02-08 06:10

Under what circumstances would you use MicrosoftAjax over jQuery in an ASP.NET MVC application?

According to Scott Cate in this podcast Object Oriented AJAX with Scott C

相关标签:
4条回答
  • 2021-02-08 06:34

    jQuery is lighter-weight, easier to integrate into standard javascript functions, and has great community support. MS Ajax is heavy, but I suspect they are rewriting everything AJAX.

    0 讨论(0)
  • 2021-02-08 06:44

    Go with jQuery - even Microsoft has seen the error of their ways. The next version of Visual Studio will include jQuery and support it with intellisense. You're also entirely correct regarding the simple plugin. MS Ajax, while sometimes easier to work with initially, is slow and bloated.

    0 讨论(0)
  • 2021-02-08 06:49

    I have tried to use both more or less side by side.

    The builtin ajax helpers works fine.

    But jquery has a smaller footprint and is more transparent in use.

    And when using the ajax helpers I get immediate results but no sense of what goes on behind the scenes

    Besides If you have to bridge over into jquery in order to extend your ajax scenario, you might as well start there.

    0 讨论(0)
  • 2021-02-08 06:52

    Just be sure to use the jQuery.ajax function and not jQuery.get - its more verbose, but vital for error handling.

    Don't skimp on error handling code just because jQuery.get() is easier. It may work on your tests, but you need some kind of error handling for the many cases it wont work.

    I'm really not sure why get doesn't have error handling, but here's a quote from the jQuery documentation for get:

    This is an easy way to send a simple GET request to a server without having to use the more complex $.ajax function. It allows a single callback function to be specified that will be executed when the request is complete (and only if the response has a successful response code). If you need to have both error and success callbacks, you may want to use $.ajax.

    0 讨论(0)
提交回复
热议问题