From f9c2addad3d5aae5c25244f3353f91add5cf7408 Mon Sep 17 00:00:00 2001 From: kmd_jamegauld Date: Wed, 6 May 2015 09:28:23 +0100 Subject: [PATCH] Added support for testing whether response from server is valid rather than requiring simple true/false. --- src/core.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core.js b/src/core.js index c7a2c9585..55bf939f2 100644 --- a/src/core.js +++ b/src/core.js @@ -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 ) {