Created
February 16, 2012 10:33
-
-
Save AlexZeitler/1843923 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $.ajax({ | |
| url: '/api/customers', | |
| cache: false, | |
| type: 'POST', | |
| data: json, | |
| contentType: 'application/json; charset=utf-8', | |
| statusCode: { | |
| 201 /*Created*/: function (data) { | |
| viewModel.customers.push(data); | |
| }, | |
| 400 /* BadRequest */: function (jqxhr) { | |
| var validationResult = $.parseJSON(jqxhr.responseText); | |
| $.validator.unobtrusive.revalidate(form, validationResult); | |
| } | |
| } | |
| }); |
Author
It's part of the jquery.validate.unobstrusive.js which is contained in the jQuery.Validation.Unobtrusive NuGet package: http://nuget.org/packages/jQuery.Validation.Unobtrusive
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
can't seem to find "$.validator.unobtrusive.revalidate". Is it a custom method? Thanks.