简体   繁体   English

如何从URL解析JSON?

[英]how to parse json from url?

Hello every one i am working on the app where i need to parse the json using java script for parsing the json. 大家好,我正在开发需要使用Java脚本解析json的json解析应用程序。 I google it a lot i try almost from two the 2 3 hour but not getting any proper answer which i am looking .Below code is what i am try . 我用谷歌搜索了很多东西,我几乎从2到2 3个小时尝试了两次,但是没有得到我正在寻找的任何正确答案。以下代码是我正在尝试的东西。

my code is : 我的代码是:

<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"> </script>
<script>

$(function() {

var entries = [];
var dmJSON = "https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20xml%20where%20url%3D%27http%3A%2F%2Fcallme.myshareus.nl%2FAPI%2FgetGroups.php%3FAPIkey%3Dte7gRRT8Ut2VYW%26InitiatorId%3D0000001%26AccountId%3D00550%26Role%3D1%0A%27&format=json&diagnostics=true?callback=?";
$.getJSON( dmJSON, function(data) {
   $.each(data.entity, function(i, f) {
      var tblRow = "<tr>" + "<td>" + f.content + "</td>" +  "</tr>"
       $(tblRow).appendTo("#entrydata tbody");
 });

});
});
</script>
</head>

<body>

<div class="wrapper">
<div class="profile">
<table id= "entrydata" border="1">
<thead>
        <th>ID</th>
        <th>Name</th>

    </thead>
  <tbody>

   </tbody>
</table>

</div>
</div>

</body>

</html>

i am not getting any responce. 我没有得到任何回应。

At the end of the URL: 在网址末尾:

?callback=?

should be: 应该:

&callback=?

In URLs, ? 在网址中, ? is used to separate the parameters from the pathname, and & is used to separate parameters from each other. 用于将参数与路径名分隔开, &用于将参数彼此分隔开。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM