ajax以xml形式获取xhtml文件
ajax以xml形式获取xhtml文件
<?xml version="1.0" encoding="utf-8"?>
<!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"
xmlns:widget="http://www.netvibes.com/ns/">
<head>
<meta name="author" content="John Doe" />
<meta name="description" content="A descriptive description" />
<meta name="apiVersion" content="1.0" />
<meta name="debugMode" content="true" />
<link rel="stylesheet" type="text/css"
href="http://www.netvibes.com/themes/uwa/style.css" />
<script type="text/javascript"
src="http://www.netvibes.com/js/UWA/load.js.php?env=Standalone"></script>
<widget:preferences>
<preference name="hellowho" type="text" label="Hello who ?"
defaultValue="World" />
</widget:preferences>
<title>Title of the Widget</title>
<link rel="icon" type="image/png"
href="http://www.netvibes.com/favicon.ico" />
<script type="text/javascript">
var HelloWidget = {
toWhom: false,
parse: function(toWhom) {
if (toWhom) HelloWidget. toWhom = toWhom;
widget.setBody('<p> Hello ' + HelloWidget. toWhom + '!</p>');
}
}
widget.onLoad = function() {
var url = 'http://example.org/api.php?hello=' + widget.getValue('hellowho');
UWA.Data.getText(url, HelloWidget.parse);
}
</script>
</head>
<body>
<p>Loading...</p>
</body>
</html>
ajax以html形式获取后 responseXML.documentElement为空?