title: JSP to return value to ajax call
body: <p>I want that jsp page that i called on ajax call to return a flag value 0 or 1 depending on my jsp code part.So to get that value I did something like this in ajax call:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
          $(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));
                      $('#message').html(msg);
              }
          });
  
          $("#gallery").show().html('&lt;img src="' + dataUrl + '" &gt;');
          var value=document.getElementById("message").innerHTML;
          alert(value);
          if(value==true){
              alert("Face Detection Success");
          }
          else if(value==false){
              alert("Face Detection Unsuccessful");
          }
          });
   });
  </code></pre>
  
  <p>And in the jsp part i only did :</p>
  
  <pre><code>&lt;%
      if(flag==true){
  
      out.println(flag);
      }
  
      else if(flag==false){
  
      out.println(flag);
  
      }%&gt;
  </code></pre>
  
  <p>How to get this value in my javascript ajax call.I want to store this value as i need to make decision based on this value.</p>
  
  <p>At present the msg that is being displayed on ajax success is : </p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
      &lt;title&gt;JSP Page&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;    
      true
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>