Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

i want to display json data from online URL to HTML table?

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <title>JSON Sample</title>
</head>
<body>
    <div id="placeholder"></div>
    <script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
    <script>
  $.getJSON('test.json', function(data) {
        var output="<ul>";
        for (var i in data.items) {
            output+="<li>" + data.items[i].Id + " " + data.items[i].name + "--" + data.items[i].old+"</li>";
        }

        output+="</ul>";
        document.getElementById("placeholder").innerHTML=output;
  });
    </script>
</body>
</html>

how i can change test.json with online URL ? its doesn't show any result can you please help me

share|improve this question
    
please write some code, which you have tried yet –  Jeetendra Chauhan Jun 4 '14 at 10:29
    
please find my updates –  user3469218 Jun 4 '14 at 10:36
    
Try attaching an error handler and see what it says. It's likely either a parsing error (bad JSON) or a network error (bad url). –  gpgekko Jun 4 '14 at 10:40
    
"test.json" should be in same domain –  Jeetendra Chauhan Jun 4 '14 at 10:49
    
Did you check this link? api.jquery.com/jquery.getjson. Example with online url works fine –  dev Jun 4 '14 at 11:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.