Hi all,

I would like to use the remote method to do a validation of user data
but I cannot configure the server-side script to simply return "true"
or "false". It can only return a JSON object like {"result":true} or
{"result":false}. How do I have to configure the remote method to
handle that?
I tried to add a custom method with $.getJSON but of course, its
result is not available yet when the custom method is called.

$.validator.addMethod('zipcode', function(value) {
        $.getJSON('/validate.php', { module: 'validate', action: 'zipcode',
zipcode: value }, function(data) {
                // What to do here with data.result?
        });
        // How to return data.result here?
}, 'Invalid areacode');

Any help highly appreciated!

Thanx,
Chris

Reply via email to