# Php/Ajax redierecting problem

**URL:** https://forum.kirupa.com/t/php-ajax-redierecting-problem/245280
**Category:** programming
**Created:** [November 28, 2007, 7:57am UTC](https://forum.kirupa.com/t/php-ajax-redierecting-problem/245280 "2007-11-28T07:57:24Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![jasvarghese](https://avatars.discourse-cdn.com/v4/letter/j/a88e57/32.png) [@jasvarghese](https://forum.kirupa.com/u/jasvarghese)
#### Post date: [November 28, 2007, 7:57am UTC](https://forum.kirupa.com/t/php-ajax-redierecting-problem/245280/1 "2007-11-28T07:57:24Z")

</div>

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:

```auto

$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…
