HTMLページの「印刷された値」を取得したい。
以下のクエリを試しましたが、showGetResult()は「null値」を返します
しかし、このコードを試してみると、Apacheサーバーのログが出力されてindex.phpにアクセスしました。
(index.phpはhelloworldを出力するだけです)
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"><\script>
<script type="text/javascript">
function showGetResult( name )
{
var result = null;
jQuery.ajax({
url: 'http://localhost/index.php',
type: 'get',
dataType: 'text/html',
success:function(data)
{
alert(data);
result = data;
}
});
return result;
}
document.write(showGetResult('test'));
</script>