Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4054692
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T14:36:28+00:00 2026-05-20T14:36:28+00:00

i am a newbie and am stuck at retrieving json data. following is my

  • 0

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:

// execute query 
        $result = mysql_query($query) or die ("Error in query: $query. ".mysql_error()); 
         $row = mysql_fetch_row($result);
         $jsonserver[$i] = $row;
    }
    echo json_encode($jsonserver); 
    header('Content-type: application/json');
    mysql_free_result($result); 
    // close connection 
    mysql_close($con);  

i am using mysql database.
when i open localhost/data.php the json data is shown on the browser.
but in case if i open localhost/index.php i donot get any desired output.
Please explain.
Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T14:36:29+00:00Added an answer on May 20, 2026 at 2:36 pm

    Hey,
    u didn’t close script tag properly

    try

    <script type="text/javascript" src="jquery-1.3.2.min_2.js"></script>
    <script type="text/javascript">
    $("document").ready(function() {
      $.getJSON("data.php",function(jsondata){
            $("#content").html(jsondata[0].content);
        });
    });
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi i am newbie in iphone and following beginning with iphone i am stuck
Helo, I'm still newbie with Core Data and suddenly stuck in these simple code:
I'm stuck trying to get mongodb data in my jade views. I'm a newbie
I'm a newbie to programming for iPhone, I'm following along this book. I'm stuck
I am new into Facebook application development and also newbie about JavaScript and PHP
I'm a newbie learning PHP. Today i have a project and being stuck, it
Ruby newbie here. I'm following the Rails Tutorial and got stuck around 5.3 re:
I am a Perl newbie, stuck with another bioinformatics problem that requires some help
I am a newbie RoR developer. I am stuck in one problem. I am
Hi i'm a newbie working through Hartl. I'm stuck on microposts in Ch 10.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.