displaying json data
displaying json data
i am a newbie and am stuck at retrieving json data.
following is my index.php :
- <script type="text/javascript" src="jquery-1.3.2.min_2.js">
- $("document").ready(function() {
-
- $.getJSON("data.php",function(jsondata){
- $("#content").html(jsondata[0].content);
-
- });
- });
- </script>
- </head>
- <body>
- <div id="content"></div>
- <div class="lg"></div>
- </body>
in my data.php i am using the standard way of encoding and sending the data:
- echo json_encode($jsondata);
i am using mysql database.
when i open localhost/data.php the json data is shown on the browser.
but in case of index.php i donot get any desired output.
Please explain.
Thanks!