I have an application where i am getting some values in the console in the form of a javascript array.now i want to send the values to the servlet.My javascript array look like this ..
0.Java
1.Perl
2.C#
This values i am getting in the console.i have to send those values to the Servlet.But i can not do that.I am able to send multiple values to the Servlet,but dont know how to send array of javascript.The way i send multiple values to the Servlet is
$.ajax({
url: "AccountServlet",
type: "post",
dataType: "json",
data: { subject1:java,subject2:perl..etc},
error:function(){
//alert("error occured!!!");
},
success:function(data){
alert(data.fullName + "\n" + data.mobileNo);
}
});
and in the Servlet i catch them
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String sub1=request.getParameter("subject1");
String sub2=request.getParameter("subject2);
;
Like this but can anyone help me how to store array of javascript here. }