I am having an ajax call to a jsp page which in turn is redirecting depending on the value of a flag variable being calculated in that jsp file.
ajax call is something like this :
$.ajax({
url: 'uploadwebcamimage.jsp',
type: "POST",
data: {
encodeimg: dataUrl,
OwnerId: document.Clickpictures.OwnerId.value,
OwnerPhone: document.Clickpictures.OwnerPhone.value,
mobilepass: document.Clickpictures.mobilepass.value,
emailpass: document.Clickpictures.emailpass.value,
mypassword: document.Clickpictures.mypassword.value,
mygroupuserid: document.Clickpictures.mygroupuserid.value
},
error : function(){
alert('Error');
},
success: function(msg){
//alert((msg));
if(msg.indexOf("true")>=0)
{
//how to get grouplist
location.href="site_index_groupadmin.jsp?res1="+grouplist;
}
else{
alert("UNSUCCESSFUL");
}
}
});
And in jsp i did something like this :
<%
ArrayList<String> list = new ArrayList<String>();
String query="Select GNAME from tbGroup";
ps1 = con.prepareStatement(query);
rs1=ps1.executeQuery();
while(rs1.next()){
list.add(rs1.getString("GNAME"));
}
//How can i send this list also to my ajax call.Please help
if(flag==true){
out.println(flag);
}
else if(flag==false){
out.println(flag);
}%>
But its not redirecting to other page.Please help