Hi guys, I was playing around with AJAX.
If I do
echo "helllo"
in the PHP file it works fine.
However, if I do something like
echo "<script language=Javascript> alert('hi');</script>";
in the PHP file, the alert()
does not come up.
Anyone know if I'm doing anything wrong?
example:
in my html file i've got this
<div id='something'> </div>
and i want the response text from the php file be placed above:
if (req.status==200) {
document.getElementById('something').innerHTML=req.responseText;
}
if i changed that to:
if (req.status==200) {
document.getElementById('something').innerHTML="<?php echo 'hi';?>";
}
it works fine, the response text will be ---> hi
but if i do echo "\"<?php echo 'hi';?>\"";
in my php file,
the response text will be ""
i hope i was clear in explaining