this is related to jquery-validate
I am trying to improve jquery validate on my site, by adding an option that I call "unique" that checks if a chosen username is already used by another user or not. To do so I check in AJAX on my DB if the username is unique or not (this works), however this.optional( element ) does not work... I think it is because "this" is not referring to "unique" anymore when on the function but I can't see a way around it.... I spent 3 hours on it looking on the web for the answer but can't find what's going on...
unique: function( value, element )
{
$.post('includes/userunique.php',{uname:value},
function(response,status)
{
return this.optional( element ) || response > 0;
});
}