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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T01:46:03+00:00 2026-06-15T01:46:03+00:00

Possible Duplicate: multi-dimensional array post from form I would like to send some data

  • 0

Possible Duplicate:
multi-dimensional array post from form

I would like to send some data from the client to the PHP server using jQuery $.post(). When it arrives at the server, I would like $_POST['myList'] to be equal to either of the following (what ever is easiest). What should I set the data object to within $.post()?

array (
  0=>array('id'=>123,'d1'=>'aaa','d2'=>'xxx'),
  1=>array('id'=>234,'d1'=>'bbb','d2'=>'yyy'),
  2=>array('id'=>345,'d1'=>'ccc','d2'=>'zzz')
)

array (
  123=>array('d1'=>'aaa','d2'=>'xxx'),
  234=>array('d1'=>'bbb','d2'=>'yyy'),
  345=>array('d1'=>'ccc','d2'=>'zzz')
)
  • 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-15T01:46:05+00:00Added an answer on June 15, 2026 at 1:46 am

    EDIT: first one looked like a simple array of objects, but seems jQuery needs this to be a keyed object:

    var send_this = {
      0: { id: 123, d1: 'aaa', d2: 'xxx' },
      1: { id: 234, d1: 'bbb', d2: 'yyy' },
      2: { id: 345, d1: 'ccc', d2: 'zzz' }
    };
    

    Second looks just has different looking keys for object containing objects:

    var send_this = {
      '123': { d1: 'aaa', d2: 'xxx' },
      '234': { d1: 'bbb', d2: 'yyy' },
      '345': { d1: 'ccc', d2: 'zzz' }
    };
    

    Tested implementation in jQuery 1.7.1:

    $.post( '/herp.php', send_this, function(d) {
        console.info( d );
    });
    

    The PHP program receives data exactly as you want it in $_POST.

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

Sidebar

Related Questions

Possible Duplicate: php multi-dimensional array remove duplicate I have an array like this: $a
Possible Duplicate: How to “flatten” a multi-dimensional array to simple one in PHP? How
Possible Duplicate: PHP Array_Sum on multi dimensional array I am having a two dimesional
Possible Duplicate: Converting an array from one to multi-dimensional based on parent ID values
Possible Duplicate: How can I convert a list<> to a multi-dimensional array? I want
Possible Duplicate: php sort array by sub-value I have a multidimensional array like the
Possible Duplicate: copy data from one matrix to another I have an array in
Possible Duplicate: Resetting a multi-stage form with jQuery Once the form submitted, response from
Possible Duplicate: PHP Sort a multidimensional array by element containing date I have some
Possible Duplicate: Android multi line editText (Text area) I would like to work with

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.