>  $('form').submit(function(){
>           var flage;
>           $.post('test.php',function(data){
>                         if(data.length){
>                         $('#message').html(data);
>                                 flage = true;
>                         }
>                         else{
>                             flage = false;
>                         }
>           });
>           return flage;
>           });
>
> I'm using this code to submit the form. if test.php has some data then
> it should be go to that page, if not it should be stay in same page.
> How  do i implement feature like Ajax when i want to check user in
> registered without being refreshed the page. if he is then page should
> be redirected otherwise not.
>
>               Please send me some tip on it. if you can send me some
> useful link then i would be delightful?


Here's one idea:

$('form').submit(function(){
    var flage, form = this;
    $.post('test.php',function(data){
        if(data.length)
            $('#message').html(data);
        else
            window.location.href = form.action;
    });
    return false;
});

Reply via email to