Php/Ajax redierecting problem

Hi All,

I am a newbie in Ajax. While i was working with login page, i am checking the user name and passwords and i am not able to redirect the page using the code:



$rs1=mysql_query("my Query");
$row=mysql_num_rows($rs1); 

 if($row>0)
    {
        header("location:UserHome.php");
        exit;
    }
    else
    {
        $response = "Invalid login...";
        echo $response;
    }


Actually i am sending back the response if the login has error, else i want to redirect the page.
But this redirect is not working properly.

Can anybody help me with a fast solutionā€¦ Im screwd.

Thanx in advanceā€¦