当
按钮
在单击以下脚本时,它应该
负载
在文件内容中”
http://tanguay.info/knowsite/data.txt
“并在屏幕上显示。
正确的语法是什么,以便.get()函数从外部网站检索数据并将其放入内容中?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript"
src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("jquery", "1.3.2");
google.setOnLoadCallback(function() {
$('#loadButton').click(loadDataFromExernalWebsite);
});
function loadDataFromExernalWebsite() {
$('#content').html('new content');
//$.get("http://tanguay.info/knowsite/data.txt", function(data) { alert(data); }, );
}
</script>
</head>
<body>
<p>Click the button to load content:</p>
<p id="content"></p>
<input id="loadButton" type="button" value="load content"/>
</body>
</html>