在Json Webserive RSS上需要帮助 [英] need help on Json Webserive RSS
本文介绍了在Json Webserive RSS上需要帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
i有一个json webserive: -
URL = http://api.geonames.org/findNearbyPlaceNameJSON?lat=47.3&lng=9&username=demo
这将以JSON格式提供输出,这个webserive的输出我想将它绑定到一个表,因为我正在尝试下面的代码但无法绑定它。我需要在下面的代码中做什么改变?
代码: -
hi ,
i have a json webserive :-
URL = http://api.geonames.org/findNearbyPlaceNameJSON?lat=47.3&lng=9&username=demo
which will give output in JSON Format, the output of this webserive i want to bind it to a table , for that i am trying the below code but not able to bind it . any changes i need to do in below code ?
Code:-
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="Scripts/jquery-1.9.1.js" type="text/javascript"></script>
<script type="text/javascript">
function callservice() {
$.ajax({
type: "POST",
url: "http://api.geonames.org/findNearbyPlaceNameJSON?lat=47.3&lng=9&username=demo",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
var Employee = response.d;
},
failure: function (msg) {
alert(msg);
}
});
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<button id="btnsample" runat="server" onclick="callservice();" >Run Service</button>
<table id="tbldata"></table>
</div>
</form>
</body>
</html>
推荐答案
.ajax({
type: POST,
url: http://api.geonames.org/findNearbyPlaceNameJSON?lat=47.3&lng=9&username=演示,
contentType: application / json; charset = utf-8,
dataType: json,
成功: function (响应){
var Employee = response.d;
},
失败: function (msg){
alert(msg);
}
}) ;
}
< / script >
< / head >
< body >
< f orm id = form1 runat = server >
< div >
< 按钮 id = btnsample runat = server onclick = callservice(); > 运行服务< / button >
< table id = tbldata > < / table >
< / div >
< / form >
< / body >
< / html >
.ajax({ type: "POST", url: "http://api.geonames.org/findNearbyPlaceNameJSON?lat=47.3&lng=9&username=demo", contentType: "application/json; charset=utf-8", dataType: "json", success: function (response) { var Employee = response.d; }, failure: function (msg) { alert(msg); } }); } </script> </head> <body> <form id="form1" runat="server"> <div> <button id="btnsample" runat="server" onclick="callservice();" >Run Service</button> <table id="tbldata"></table> </div> </form> </body> </html>
这篇关于在Json Webserive RSS上需要帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文