I'm currently facing an issue with posting an array of JavaScript elements into a Java array of Strings. Here's the situation...
The JavaScript code I have is as follows:
var quantity_arr = new Array();
for (var i=0; i< <%= cart.size() %>;i++) {
quantity_arr[i] = document.getElementsByClassName("quantity")[i].value;
}
xmlhttp.send("sum_of_order="+sum_of_order+"&credits_number="+credits_no+"&credit_card_number="+credit_card_number+"&quantity_arr="+quantity_arr);
And here is the corresponding Java code:
String[] myParams = new String[cart.size()];
String order_id = Integer.toString(temp);
String customer_id = "'"+session.getAttribute("user_id")+"'";
String date = "15/29/12";
String sum = request.getParameter("sum_of_order");
String credit_card = "'"+request.getParameter("credit_card_number")+"'";
String credits = "'"+request.getParameter("credits_number")+"'";
myParams = request.getParameterValues("quantity_arr");
All the parameters are functioning well except for the myParams array
, which remains empty. Any assistance or suggestions would be greatly appreciated!