我尝试在ajax页面中运行java脚本代码。这是第一个使用ajax.i调用request.php页面的page.i,该页面(request.php)脚本剂量wok.how我可以运行java脚本在该页面上(request.php)
<html>
<head>
<script>
function check(str2)
{
if (str2=="")
{
document.getElementById("msg").innerHTML="";
return;
}
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("msg").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","request.php?j="+str2 ,true);
xmlhttp.send();
}
</script>
</head>
<body>
<button type="button" onclick="check(this.value)">check</button>
<div id="msg"></div>
</body>
</html>
这是使用ajax的request.php页面
<html>
<body>
<script>
function check()
{
alert("hello");
}
</script>
</body>
</html>