I want to pass two List<String>
to Gson and catch them with $.post
in my jQuery. Currently I have my first list in my servlet:
String json_list = gson.toJson(suggested_list);
response.setContentType("application/json");
response.setCharacterEncoding("UTF-8");
response.getWriter().write(json_list);
and I get it with the $.post like this:
$(document).ready(function() {
$(".word_sugest").click(function() {
var physical_exam = jQuery("textarea#examination").val();
$.post("MyServlet", { examination : physical_exam},function(responseJson) {
var $textarea = $('<textarea rows="10" cols="20" id="words_suggested">').appendTo($('#words'));
var areavalue = $('#words_suggested').val();
$.each(responseJson, function(key,value) {
$('#words_suggested').val($('#words_suggested').val()+value+"\n");
});
});
});
});
How can I get another list with the same $.post
Ajax-event? Can someone please help?