Skip to content

Instantly share code, notes, and snippets.

@AlexZeitler
Created February 16, 2012 10:33
Show Gist options
  • Select an option

  • Save AlexZeitler/1843923 to your computer and use it in GitHub Desktop.

Select an option

Save AlexZeitler/1843923 to your computer and use it in GitHub Desktop.
$.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);
}
}
});
@amanmahajan7

Copy link
Copy Markdown

can't seem to find "$.validator.unobtrusive.revalidate". Is it a custom method? Thanks.

@AlexZeitler

Copy link
Copy Markdown
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