Here is my code for that:
<html>
<head>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript">
function test(id)
{
alert("I am inside javascript: "+id);//Alert box shows perfectly without errors
/*function test1()
{
var id2=id;
alert("I am inside php" +id2);
return id;
}*/
//document.write("value of temp is ",temp);
<?php
if(isset($_GET['id']))
{
$samp = $_GET['id'];
}
echo 'alert("I am inside php" .$samp);';//This shows 'undefined
?>
}
</script>
</head>
<body>
<input type="button" onclick="test(555);" value="Button">
</body>
</html>
Now, what is happening is that, first a value of 555 is getting passed to test and an alertbox is showing
I am inside javascript:555 The next alert box is showing 'Undefined'.
I have gone through various examples regarding this but am not able to find out the main reason behind this. Any help will be appreciated.
Thanks
Regards,
Raghav

New Topic/Question
Reply



MultiQuote






|