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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T23:59:57+00:00 2026-05-29T23:59:57+00:00

This is my code: $.post(‘<?php echo site_url(‘channel_partners/get_cp_text’); ?>’, {cp_lang: language}, function(data) { alert(‘icon: ‘

  • 0

This is my code:

$.post('<?php echo site_url('channel_partners/get_cp_text'); ?>', {cp_lang: language},
       function(data) {
        alert('icon: ' + data.cp_icon);
        }
    );

The URL is CodeIgniter. Don’t be distracted by that. It returns the proper data, too. If I alert data I get the proper JSON-encoded array back. It looks like this.

{"cp_icon":"test1","authorized_cp":"test2"}

So I how do alert “test1” if not by data.cp_icon? If I use data.cp_icon, I get an undefined result.

  • 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-29T23:59:59+00:00Added an answer on May 29, 2026 at 11:59 pm
    $.post('<?php echo site_url('channel_partners/get_cp_text'); ?>', {cp_lang: language},
       function(data) {
            alert('icon: ' + data.cp_icon);
        }, "json"
    );
    

    Adding the data type will tell it to parse it as JSON and not as just a string (which is what is happening).

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

Sidebar

Related Questions

I'm using this code $.post(assets/scripts/chat/load_convos.php,{}, function(data) { $.each(data, function(index, value) { alert(value); }); ,and
I am running this code : $.post('https://graph.facebook.com/me',{}, function(msg){ console.log( Data Saved: + msg );
Why does this code post data twice ? $.post(send/user/sent.php, { url: response, secret_key: secret_key
I have this code: $.post(php/tagNotifUnsub.php, $(#tagNotifUnsub).serialize(), function(){ $('#tagSubDiv').load('tags.php #tagSubDiv', function(){$( button, input:submit, input:button, a#jql,
Django code samples involving post data often shows code similar to this: if request.method
i'm using this code to post to a php page: var qreq = .....myurl.php;
$('#com_form').submit(function(){ var ele = $(this); $.post(includes/agenda_com.php, { texte : ele.find('textarea').val(), id : ele.find('#agenda_id').val(); },
I tried this code: $.post('/script', function(result) { var foo = $(result).find('#foo'); $('#result').html(foo); }); Here's
This code produces a POST request: urllib2.urlopen(http://somedomain.com/, data) I would like to produce a
I have this little code to post via ajax: $('#submit').click(function () { var myName

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.