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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T09:02:11+00:00 2026-06-18T09:02:11+00:00

I have the following array: Array ( [0] => Array ( [id] => 179

  • 0

I have the following array:

Array
(
[0] => Array
    (
        [id] => 179
        [user_id] => 191
        [behandeling] => msg
    )
)

For some reason i can’t get the value of ‘behandeling’ .. i have tried several ways, like:

console.debug(msg[0].behandeling);

Some more info about building the array:

$d[] = array('id' => $row['id'],
        'user_id' => $row['user_id'],
        'behandeling' => $row['behandeling']);
//print_r($d);
//echo json_encode($d);

If i use print_r($d), the value of behandeling = CORRECT.
If i use json_encode($d), the value of behandeling will be null..

EDIT:

I think i found the problem.. When submitting the data, the data is being send unescaped in this way:
var data = 'actie=Wijzig&module=treatment&treatments=' + treatment.val();

This means if there are certains characters which need to be escaped, & etc.. the data string gets broken… which results in null and/or half msgs…

EDIT2:

The finding described above is very important, but describes a different section of the site. Saving the data is going fine now, but still having difficulties returning the value of the data of SOME messages..

  • 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-18T09:02:12+00:00Added an answer on June 18, 2026 at 9:02 am

    As stated in the comments that’s a PHP array, you could try the following:

    <script type="text/javascript">
      var myArray = <?=json_encode($array)?>;
      var behandeling = myArray[0].behandleing;
    </script>
    

    Update:

    I believe Javascript is interpreting the JSON as a regular string due to your content-type header.
    You should try adding

    header('Content-Type: application/json'); 
    

    when outputting your JSON.

    Alternatively, if for whatever reason you can’t change the headers and you’re using jQuery you can try:

    var parsed = $.parseJSON(ajaxResults);
    var behandling = parsed[0].behandling;
    

    Without jQuery you can use eval however there are security implications involved.

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

Sidebar

Related Questions

I have the following array and i want to access the value of a
I have the following: array<Point>^ ADC1=gcnew array<Point>(2); ADC1={Point(period,points[0][0]),Point(period,points[0][1])}; // error here! However I get
i have following array, and i have tried to add comma with the following
I have the following array. Note that some times there are more params, sometimes
I have the following array in NumPy: A = array([1, 2, 3]) How can
I have following array, that I need to operate by hand on bitmaps. const
I have the following array: $franchise_a_status[] = array( 'id' => $franchise['franchise_id'], 'text' => $franchise['franchise_surname'].
I have the following array(in python): arr= ['\n', ' a#B\n', ' c#D\n'] Now I
I have taken following array; to fill-up gallery: private Integer[] mImageIds = { R.drawable.one,
I have the following array: Array ( [0] => BCD [1] => ACE [2]

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.