How to get the return from php to javascript?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/1594411/call-php-from-javascript-and-return-an-array-from-php-to-javascript-function">Call php from javascript and return an array from php to Javascript function</a>  </p>
</blockquote>



<p>i am having an php code for verification of User in XML</p>

<p>For Eg: ValLogin.php</p>

<pre><code>&lt;?php
$userName =  $_REQUEST["username"];
$password =  $_REQUEST["password"];
$iCount = 0;
$loginArray = array();
$xml = simplexml_load_file("Logintest.xml");
for ($i=0;$i&lt;2;$i++)
{
    foreach($xml-&gt;Username[$i]-&gt;attributes() as $a =&gt; $b)
    {
        $loginArray[$iCount] = $b;
        $iCount++;
    }
    if($userName == $loginArray[0] &amp;&amp; $password == $loginArray[1])
    {
        header("Location: EHP_Configuration.html");
        return ;
    }
    $iCount = 0;
}
echo "&lt;SCRIPT LANGUAGE='javascript'&gt;alert('asd')&lt;/SCRIPT&gt;";
header("Location: Login.html");
?&gt; 
</code></pre>

<p>HTML</p>

<pre><code>&lt;form method = "post" action = "ValLogin.php"&gt;
&lt;/form&gt;
</code></pre>

<p>echo does not work as expected. it directly shows redirect to Login</p>

<p>How can i get the message invalid username/Login?</p>
