JavaScript creating nested array javascript creating nested array javascript,create nested array php,create nested

Have looked at many examples but cant seem to get to make an nested array to store some data nicely. How can I get the following code to work? It gives me an error now:

var shipdata = [];

shipdata['header']['bedrijfsnaam'] = $('[name="bedrijfsnaam"]').val();
shipdata['header']['naam'] = $('[name="naam"]').val();
shipdata['header']['straat'] = $('[name="straat"]').val();
shipdata['header']['postcode'] = $('[name="postcode"]').val();
shipdata['header']['plaats'] = $('[name="plaats"]').val();
shipdata['header']['telefoon'] = $('[name="telefoon"]').val();
shipdata['header']['email'] = $('[name="email"]').val();
shipdata['header']['instructies'] = $('[name="instructies"]').val();
shipdata['header']['ordernummertje'] = $('[name="ordernummertje"]').val();

$(".pakketten").each(function(index, element) {

            index++;
            shipdata['pakketten']['pakket'+index]['lengte'] = $('[name="lengte'+index+'"]').val(),
            shipdata['pakketten']['pakket'+index]['breedte'] = $('[name="breedte'+index+'"]').val(),
            shipdata['pakketten']['pakket'+index]['hoogte'] = $('[name="hoogte'+index+'"]').val(),
            shipdata['pakketten']['pakket'+index]['gewicht'] $('[name="gewicht'+index+'"]').val()


        });

Probably im doing this all wrong, but some pointers would be welcome.

Thanks!

Answer:1

I am Working on Codeigniter and am getting a problem while inserting values in database via ajax. Problem occur when sql query throws an error. This is My Controller code:- public function ...

I am Working on Codeigniter and am getting a problem while inserting values in database via ajax. Problem occur when sql query throws an error. This is My Controller code:- public function ...

  1. jquery ajax data shows object object

I need to store a list of points and check if a new point is already included in that list class Point { x: number; y: number; constructor(x: number, y: number) { this.x = x; ...

I need to store a list of points and check if a new point is already included in that list class Point { x: number; y: number; constructor(x: number, y: number) { this.x = x; ...

I'm using Auth0 rules to add some info to the user profile. When reading the profile from the web app: $userInfo = $auth0->getUser(); the data added by the rules does not seem to be there. Is ...

I'm using Auth0 rules to add some info to the user profile. When reading the profile from the web app: $userInfo = $auth0->getUser(); the data added by the rules does not seem to be there. Is ...

I've starting to dig my teeth into backbone and when working with a router function creating and destroying views I came across this little snippet, which didn't quite make sense to me as I've always ...

I've starting to dig my teeth into backbone and when working with a router function creating and destroying views I came across this little snippet, which didn't quite make sense to me as I've always ...

  1. javascript logical operator precedence
  2. javascript logical operator multiple conditions
  3. javascript logical operator short circuit
  4. javascript logical operator
  5. javascript logical operator return value
  6. javascript logical operator evaluation
  7. javascript logical operator priority
  8. javascript logical operator not
  9. javascript logical operators examples
  10. javascript logical operator xor
  11. javascript logical operator opposite
  12. javascript logical operator if statement
  13. javascript logical operators condition
  14. javascript logical operator check
  15. js logical operator
  16. js logical operator precedence
  17. javascript comparison operator
  18. javascript comparison operator as variable
  19. javascript comparison operator mean u003du003d
  20. javascript bool operator