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

  • SEARCH
  • Home
  • 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 7732369
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T06:42:49+00:00 2026-06-01T06:42:49+00:00

How can I get the array data from a JSON sent back by my

  • 0

How can I get the array data from a JSON sent back by my php script?

PHP code:

<?php
//connects to database
include 'connect.php';
$callback = $_GET['callback'];

$query = mysql_query("SELECT * FROM users");
$rows = array();
while($r = mysql_fetch_assoc($query)) {
   $rows[] = $r;
}

$out_string = json_encode($rows);

print $callback.'('.$out_string.');';
?>

The php code above puts all of user table’s rows into an array and JSONencodes it. It is then sent back to this script:

$.getJSON(domain_path + 'generate.php?table=' +  tbname + '&callback=?', function(data) {
});

How can I display each row from the JSON array sent back?

For example the data will be sent back is:

([{"name":"user1","link":"google.com","approve":"true"},{"name":"user2","link":"yahoo.com","approve":"true"},{"name":"user3","link":"wikipedia.com","approve":"true"}]);

How would I use javascript (jQuery) to display it out like this:

Name: User1 , Link: google.com , Approve:True
Name: User2 , Link: yahoo.com , Approve:True
Name: User3 , Link: wikipedia.com , Approve:True
  • 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-06-01T06:42:51+00:00Added an answer on June 1, 2026 at 6:42 am

    You should do

    function(data) {
        $.each(data, function(){
            $('#result').append('<p>Name:'+this.name+' Link:'+this.link+' Approve'+this.approve+'</p>');
        });
    }
    

    fiddle here http://jsfiddle.net/hUkWK/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Data sent from client will not get deserialized. Client: $.ajax({ type: 'POST', dataType: json,
How can I get an array of values from an associative array ? Associate
how can i get elements uniquely from an array
how can i get [user_id] from this array? Array ( [2] => cbpaidSubscription Object
I am trying to populate a UITableView with data from json result. I can
How can I get the array values return by a Json format in twitter.
I seem to have trouble with getting data from a php array, I've looked
I am trying to use the data I have received from a php script,
i retrieved data from mysql tables in json using php i.e $table_first = 'recipe';
I am getting some data from a database and am encoding it to json:

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.