I am trying to build a shopping cart application. I have all the items in shopping cart inside a javascript object called Cart. Data in Cart is of the form {"sku"=quantity} For example.
Cart={"5x123"=1,"5x125"=3}
Now I have a form which accepts shipping and billing address.
<form method="post" action="/perl/xxxx/echo.cgi">
<table>
<tr>
<td>Name:</td>
<td><input type="text" name="name" size="30" /></td>
</tr>
<tr>
<td>Shipping Address:</td>
<td><Input type="text" name="address" id="saddress" size="40" /></td>
</tr>
....
<tr>
<td><input type="reset" /></td>
<td><input type="submit" value="Submit Order"/></td>
</tr>
</table>
</form>
When I submit this form I need to store "sku" and "quantity" from Javascript Object Cart into DB using perl.
Could someone please tell me the easiest way to do this?
Should I ajax or hidden values in form?
If I use ajax, then how to retrieve values from Cart inside perlscript?
If I use hidden values this way
<input type=hidden name=sku value="">
//How to populate value field
//I need to have as many hidden fields as the number of items in cart
Thanks,