Attempting to make an ajax call to a jsp page as shown below:
$(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 + '" >');
});
});
The issue now faced is that in the resulting jsp page, certain decisions need to be made based on flag values, as illustrated below:
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 accomplished since the alert box is not displaying currently? Assistance needed.