Calling a parameterized javascript function from php [migrated]
- by Ginger
I need to call a javascript function from php, by passing a value in php variable. My code goes like this:
echo '<tr class="trlight"><td onclick="callVehicle('.$qry_vehicleid.');"><label>Call Vehicle</label> </td></tr>';
And in javascript file I try to execute the following code:
function callVehicle(vid)
{
alert('Call '+vid);
document.getElementById("SearchResult").style.visibility="hidden";
}
and an error test is not defined occurs. test is the value that I assigned to variable $qry_vehicleid. Can someone please point out what the mistake is?