0

我正在尝试对宁静的 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>
4

0 回答 0