Is there a good explanation of what ASP.NET MVC3 does with its ajax helpers and rendering unobtrusive javascript?

I am trying to find a good (detailed) explanation of what happens when you use ajax MVC helpers. What css events and classes are being added. I can find a package of information here and there, but not a general explanation of how this ajax structure works. Is there a good explanation?

+6
source share
2 answers

Ajax helper methods display Html on your page.

The best way to see what the Ajax helper method adds is to look at the source when it appears in your browser at runtime.

You can even see the unobtrusive material provided in the source if you remove the link to jquery.unobtrusive-ajax.js.

You can also write your own Ajax helper methods (and Html) in the form of extension methods.

+1
source

MVC3 Ajax Helpers simply add some css class names and data to a form element. You must include jquery.unobtrusive-ajax.js in your project.

When dom is ready, this script looks for form elements with the above css class names. When the form is submitted, the script will catch the event, serialize the form values, use $ .ajax to call the destination URL and can put the response in the specified element identifier or pass it to your custom js method, depending on the options you used.

input-validation-error and valid input-validation classes are used for unobtrusive validation, which is not the same as unobtrusive ajax (they share only the word unobtrusive). It needs jquery.validate.unobtrusive.js and convert the microsoft script check to jquery validation check. See http://rocketsquared.com/wiki/Plugins/Validation for more details to verify jquery validation.

0
source

Source: https://habr.com/ru/post/900710/


All Articles