Q: call javascript function with parameters from php code I want call a javascript function from php and execute a ajax call.My php code is:
echo '<script>change2('.$stand.'); </script>';

and my js code is :
function change2(c){
alert(c);
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
    xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
    xmlhttp.onreadystatechange=function()
    {
        if (xmlhttp.readyState==4 && xmlhttp.status==200)
        {
            document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
        }
    }

    xmlhttp.open("GET","change2.php?c="+c,true);
    xmlhttp.send();

    }

The alert return undifined..

A: You can do this : <input type="hidden" value="<?php $stand ?>" id="someID">
and in your Js 
<script>change2(document.getElementByID('someID'); </script>

I think it's working.
