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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T16:08:47+00:00 2026-05-17T16:08:47+00:00

I am having a little trouble retrieving the values from a JSON object that

  • 0

I am having a little trouble retrieving the values from a JSON object that is returned after a jQuery GET request and I am hoping someone here will be able to help. I think I may be doing something stupid but cannot figure it out.

In firebug the response is show as:

[{"plan_id":"2","plan_name":"plan 2","plan_desc":"plan 2 desc"}]

However when I try to retrieve the values they are undefined.

Here is the code I am using:

jQuery(function(){
jQuery("#add_plan").click(function(){
var val = jQuery("#plan_id").val();
if (!isNaN(val))
{
      jQuery.ajax({
      success: function(data) {
        if (data)
        {

         jQuery("#plan-list").append(
"<li>"
+ " <label for=\"plans\">" + data.plan_name + "</label>"
+ "</li>"
); 
        }
      },
      type: 'GET',
          dataType: 'json',
          url: 'http://example.com/plans.php?plan=' + val 
      });
}
});
});

Any help would be appreciated.

Thanks

Paul

  • 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-17T16:08:48+00:00Added an answer on May 17, 2026 at 4:08 pm

    Since it’s an array, you need data[0].plan_name instead, or possibly a loop like this if you expect multiple results:

    $.each(data, function() {
      $("<label for='plans' />").text(this.plan_name).wrap("<li />").parent()
        .appendTo("#plan-list");
    });
    

    You can give it a try here.

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

Sidebar

Related Questions

I'm having a little trouble getting Jquery to play nice with cakephp and I'm
Question: I'm having a little trouble with jQuery: Consider this HTML, where I want
Having a little trouble processing my NSStrings into a valid JSON string. NSString *version
I am having a little trouble understanding ServiceKnownType in WCF. Taken from this blog
I'm having a little trouble using jQuery in Rails. I'd like to call the
I'm having a little trouble trying to get WarpPointer to work out appropriately for
I'm having a little trouble with in app purchases. My app downloads a JSON
Having a little trouble on this one. I need a way using Jquery/JS to
I'm having a little trouble reading the values of all the sub child nodes
I'm having a little trouble overloading methods in C#. I have two methods that

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.