I am making an ajax call to a jsp page like this :
$(document).ready(function () {
$('#photo').photobooth().on("image", function (event, dataUrl) {
alert(dataUrl);
//alert($('#mygroupuserid'));
//alert(document.Clickpictures.OwnerId.value);
//alert(imgdata);
$.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);
}
});
$("#gallery").show().html('<img src="' + dataUrl + '" >');
});
});
Now in that jsp page i have to make decision basis on some flag value like this :
if(flag==true){
out.println("<script>alert('Face Successfully Detected and Password has been sent');document.location='Main.jsp'</script>");
}
else if(flag==false){
out.println("<script>alert('Sorry,Face Cant Be Detected.Try Again');</script>");
}%>
How can this be achieved.?As this alert box is not being printed right Now.Please help