if the data is on the form {"result":true} you can use var returnObj = JSON.parse(data) if you use http://www.json.org/json_parse.js and return returnObj.result you can also use
regards, Bjarki Heiðar On Oct 7, 9:13 am, zeussolo <chris.neuhaeu...@gmail.com> wrote: > 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