title: How to get Ajax response in Struts2
body: <p>I have refered this link <a href="https://stackoverflow.com/questions/19408257/sending-data-from-jsp-to-struts2-action-class-using-jquery-ajax">Ajax action calling</a> But I am not able to 
  Hi making an action call using ajax.
  here is my code. </p>
  
  <pre><code>   $.ajax({
              type:'POST',
              dataType:'json',
              url:'ajaxAction?ajax_docno='+entry1+'-'+entry2+'-'+entry3+'-'+entry4,
          success:function(data,textStatus,jqXHR)
                     {
                       if(jqXHR.status==200)
                          alert("success");
                        }
                       if(jqXHR.status==500)
                         {
                             alert("Fail");
                            }
                 }
  
  
                 }
                     );
  </code></pre>
  
  <p><strong>MY STRUTS.XML</strong></p>
  
  <pre><code> &lt;action name="ajaxAction" class="com.AjaxActionClass" method="checkExistence" &gt; 
          &lt;result name="success" type="httpheader"&gt;
                  &lt;param name="status" &gt;200&lt;/param&gt;
          &lt;/result&gt;
          &lt;result name="fail" type="httpheader"&gt;
                  &lt;param name="status" &gt;500&lt;/param&gt;
          &lt;/result&gt;
  
      &lt;/action&gt;
  </code></pre>
  
  <p><strong>In MY ACTION class</strong></p>
  
  <pre><code> public  String checkExistence()
     {
          //DB checkup
           if exists return success;
           if not exists return fail;
         }
  </code></pre>
  
  <p>THis  is working fine </p>
  
  <p>In my action class I am checking data existence in DB and returning some value to jSP to show the message.</p>
  
  <p>My problem is how to pass a variables to jsp to show some <code>alert</code> message to USER if Data is not In DB. </p>