jQuery returns full page to Ajax
<p>Here's  a link i saw but still confused over the answers provided for them : <a href="http://stackoverflow.com/questions/2586217/jquery-ajax-returns-the-whole-page">jQuery Ajax returns the whole page</a></p>

<p>My situation is something similar. </p>

<p>I have a index.php that calls for a popup login form, that tries to submit this login information to a ajax call to another php called login_check.php.</p>

<p>This is my index.php :</p>

<pre><code>var dataString = 'email='+ email.val() + '&amp;password=' + password.val();

$.ajax({
type: "POST",
url: "login_check.php",
data: dataString,
cache: false,
error: function (request, status, error) {
    alert("An error occured while trying to complete your request: " + error);
},
success: function(data)
{
    alert(data);

}
}); 
</code></pre>

<p>This is what is in my login_check.php :</p>

<pre><code>session_start();

//input from login form 
$myemail = htmlspecialchars(trim($_POST['email']));
$mypassword = htmlspecialchars(trim($_POST['password']));

//selecting from database to check user account
$sql="SELECT * FROM user WHERE email='$myemail' and password='$mypassword'";
$result=mysql_query($sql);
$row=mysql_fetch_array($result);
$count=mysql_num_rows($result);

//If result matched $myemail and $mypassword, table row must be 1 row 
if($count==1)
{   
    echo 'true';
    session_register("myemail");
    $_SESSION['login_user']=$myemail;
}   
else if($count==0)
{
    echo 'false';
}
</code></pre>

<p>And the output of the alert box is the full html of the page i am currently in, i.e. index.php.</p>

<p>And i have no idea whyy. ):</p>
