Problem with form send

Here is my code :

index.html :


Test - Identification
<style type="text/css" media="screen">
html, body{
	overflow: hidden;

.dhx_calendar_click {
	background-color: #C2D5FC !important;

login.php :

<?php header("Content-Type: text/plain"); include ('config.php'); $user=$_REQUEST["user"]; $pass=$_REQUEST["pass"]; $res=mysql_connect($mysql_server,$mysql_user,$mysql_pass); mysql_select_db($mysql_db); $resultat = mysql_query("select * from users where username='".$user."' and password='".$pass."'"); $nblignes=mysql_num_rows($resultat); if ($nblignes>0) { echo "ok"; } else { echo "erreur"; } ?>

When i enter bad login and password, i have the logical alerts :

  • “response = erreur”
  • “erreur d’identification : erreur”

When i enter good login and password, i have the alerts :

  • “response = ok”
  • “erreur d’identification : ok”

So my script can’t see that : response == ok

Anyone have an idea ?

With Firebug you can see there is a space in response and was "ok " and not “ok” !

I have a space after : "ok "

and when in my code i insert


i obtain :

Hi all

Correct, the following code can be used:

form_login.send('login.php', null, function(loader){ alert(loader.xmlDoc.responseText) });

I know to make a if to compare if it’s equal to “ok”