Skip to content

Commit

Permalink
Added support for testing whether response from server is valid rathe…
Browse files Browse the repository at this point in the history
…r than requiring simple true/false.
  • Loading branch information
kmd-jamesgauld committed May 6, 2015
1 parent 63cb473 commit f9c2add
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -1299,8 +1299,10 @@ $.extend( $.validator, {
data: data,
context: validator.currentForm,
success: function( response ) {
var valid = response === true || response === "true",
errors, message, submitted;
var valid = (typeof param.validateResponse === 'function' && param.validateResponse(element, response))
|| response === true
|| response === "true",
errors, message, submitted;

validator.settings.messages[ element.name ].remote = previous.originalMessage;
if ( valid ) {
Expand Down

0 comments on commit f9c2add

Please sign in to comment.