I stored some integer value in an array called myArray. I want to use Ajax to send myArray to a jsp file (file.jsp). I'm having trouble retrieving the data in jsp, as I always get null. Here is my code:
var request = $.ajax({
url: "file.jsp",
type: "POST",
data: {myArray:myArray},
dataType: "html"
});
request.done(function(msg) {
$("#abc").html( msg );
});
request.fail(function(jqXHR, textStatus) {
alert( "Failed " + textStatus );
});
file.jsp
String myArray = request.getParameter("spArray");
My question is: How can I successfully pass myArray from jquery-Ajax and retrieve it in file.jsp?