jQuery vs MicrosoftAjax in ASP.NET MVC

前端 未结 4 1650
不知归路
不知归路 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: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.

提交回复
热议问题