我想获得html页面的'打印值'。jquery ajax获取返回值
我想下面的查询,但showGetResult()只是返回“空值”
但我的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>