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 8746681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:13:59+00:00 2026-06-13T12:13:59+00:00

both can be divided into separate arrays formatted JSON string returned by the php

  • 0

both can be divided into separate arrays formatted JSON string returned by the php script?
my JS code

function GetData(id){
    $.ajax({
        url: 'list.php',
        data: 'id=' + id,
        type: 'POST',
        success: function(data){
            alert(data)
            console.log(data)
        }
    })
}

my list.php

<?php
$id = $_POST['id'];
$connect = mysql_connect("localhost", "admin", "118326") or die(mysql_errno());
$db = mysql_select_db("flabers", $connect) or die(mysql_error());
$result = mysql_query("SELECT * FROM list WHERE id = '$id'") or die(mysql_error());
$array = mysql_fetch_assoc($result) or die(mysql_errno());
echo json_encode($array);
?>

return json string

{"id":"88","country":"Korea, Japan, USA","brand":"Samsung, Sony, HTC"} 

how to get the two arrays country and brand?

  • 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-13T12:14:00+00:00Added an answer on June 13, 2026 at 12:14 pm

    Parse json in the below way.

    //var obj = JSON.parse(jsonstring); //javascript way
    
    var obj = jQuery.parseJSON(jsonstring); //jquery way
    
    alert(obj.country + " : " + obj.brand);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My questions are divided into three parts Question 1 Consider the below code, #include
I have some POCO classes which can generally divided into two groups, for example:
It seems both can be overloaded, but somebody said not..... What's the case?
I want to compare two strings for equality when either or both can be
I am trying to see if the performance of both can be compared based
I have several divs with class image and several with class thumbnail (both can
I've built an Authenticator, I've built a SyncAdapter (both can be manually executed through
I have three entities. Author Newspaper Dissertation Newspaper and Dissertation both can have one
I'm looking to know both what can be customized as well as the recommended
I'm writing an app where a user can both create their own pages for

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.