0

is there a way to do this? Im not to good with javascript brackets etc...

item: ($('input#title'+id).val(),$('input#qty'+id).val(),$('input#price'+id).val()),

I tried the above but it only gives me the last values,

Firebug gives me:

item_1  7
item_2  7
item_3  7
item_4  7
item_5  7

What im after is:

item_1  Burgers,3,12.50
item_2  Sandwiches,7,7.50
item_3  Fries,10,5.50
item_4  Drinks,10,2.50
item_5  Pancakes,12,7.50

I want to do it this way because it just would be easier to grab that csv array and then insert the data per row.

Im basically inserting the data into a mysql table where i can display it for the client as a food order.

Thanks in advance Jonny

jonnypixel
  • 327
  • 5
  • 27
  • Thank you, is it worth a post from you? so i can give the green tick? or should i just add an edit to my post. – jonnypixel Jul 05 '12 at 12:32

1 Answers1

0

Use square brackets instead, assuming you want an array.

item: [$('input#title'+id).val(),$('input#qty'+id).val(),$('input#price'+id).val()],

Here is a post that explains your initial problem: Javascript "tuple" notation: what is its point?

Community
  • 1
  • 1
mplungjan
  • 169,008
  • 28
  • 173
  • 236