【发布时间】:2025-12-17 09:55:02
【问题描述】:
能够调用 Eclipse 控制台输出证明的我的 Web 服务的 url。 但无法将其解析为 HTML 表格。出于测试目的,我在 get.JSON 函数中编写了一个 windows.alert。但它不起作用,但是调用服务如下图所示: - 任何人都可以帮助我。 谢谢。
after clicking on clickme button on webpage the console get printed: proof of webservice call:
HTML 页面代码:-
<!DOCTYPE html>
<html>`enter code here`
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>item svc demo</title>
<p id="demo"></p>
<script
src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js">
</script>
<script>
function myFunction(jQuery)
{
window.alert(5 + 6);
$.getJSON("http://localhost:8080/OnlineStore/kmsg/grocery/item",
function (data) {
window.alert(9 + 6);
}
);
};
$(document).ready(myFunction);
</script>
</head>
<body>
<table id="itemTable" border="2">
<tr>
<th>itemno</th>
<th>offerPercent</th>
<th>regQtyBuyLimit</th>
<th>offerQtyBuyLimit</th>
<th>minReOrderLevel</th>
<th>pkg</th>
<th>addedOn</th>
<th>updatedOn</th>
<th>mrp</th>
<td>regPrice</th>
<th>minBulkQty</th>
<th>bulkDiscount</th>
</tr>
</table><br /><br />
<button onclick="myFunction()">Click me</button>
</body>
</html>
【问题讨论】:
-
我想用javascript来做...请帮助别人
-
请注意,这类“帮我调试”问题对社区不是很有用。请尝试隔离错误并将其作为更通用的问题。
-
也改进了格式。
-
@devpro 对不起,我没听懂你……什么格式?
标签: html json spring web-services parsing