I have a servlet list:
String appname=request.getParameter("AppID");
System.out.println("Entered ajax request 1 : Get list");
List<Object> li = Model.getList(appname);
// enter your code here
I have an AJAX call which is taking that list from the servlet:
$(document).ready(function() {
$('#app-name').change(function () {
var applname=$(this).value();
$.ajax({
url: '${pageContext.request.contextPath}/rollreturn',
data: {AppID:applname},
success: function(data){
var order_data = data;
$('#roll-name').html('');
$.each(order_data, function(i, item) {
$('<option value='+ order_data[i] +'>'+order_data[i]).html('</options>').appendTo('#roll-name');
});
}
});
});
});
How can I pass the list to the AJAX call. Can you help me with this?
Also can you tell me whether the AJAX call I have written is correct or not?