Thank you, that has worked.  I tried exactly the same thing before
because i though that returning the boolean from within the $.ajax
method might not work.  However instead of using "bool = true;" i was
using "var bool = true;".  Have you any idea why using the prefix of
var would stop this working?

On Aug 10, 11:52 am, Steven Yang <kenshin...@gmail.com> wrote:
> if thats the case try
> function checkIfUsername(o)
> {
>   var bool;
>        $.ajax({
>                type: "POST",
>                url: ""+CI_ROOT+"index.php/admin/check_if_username",
>                data: ({username: username.val()}),
>                async: false,
>                dataType: "json",
>                success: function(data){
>                        if(data.bool == true){
>                                o.addClass('ui-state-error');
>                                updateTips("Your username must be unique");
>                                //return false;
>    bool = false;
>                        }
>                        else{
>                                //return true;
>    bool = true;
>                        }
>                }
>        });
>   return bool;
>
> }
>
> i am not very familiar with the case that async:false
> but from what you described, this should work

Reply via email to