我正在尝试对一个安静的xml Web服务进行简单搜索,但没有输出。
实施例: http://wsearch.nlm.nih.gov/ws/query?db=healthTopics&term=asthma
此处有更多信息:http://www.nlm.nih.gov/medlineplus/webservices.html
有什么想法吗?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript" src="http://code.jquery.com/jquery.js"></script>
<script type="text/javascript">
function DoSearch() {
var searchVal = $('#searchString').val();
alert('called ' + searchVal);
var url = "http://wsearch.nlm.nih.gov/ws/query?db=healthTopics&term="+searchVal;
$.get(url, function( data ) {
$( "#resultsDiv" ).html( data );
alert( "Load was performed." );
});
}
</script>
</head>
<body>
<div>
<input id ="searchString" type="text" /><input type="button" value="Search" onclick="DoSearch();" />
</div>
<div id="resultsDiv"></div>
</body>
</html>