title: Struts 2 action not returning desired result to Jquery Ajax call
body: <p>I am calling an action from jQuery Ajax with the following code and it returns me complete code of JSP page. All I need is the array list that is defined in the action class.</p>
  
  <p><strong>dashboard.js</strong></p>
  
  <pre><code>$.ajax({
   url : 'ELD/getAllDivisions',
   type : 'POST',
   dataType: 'text/javascript',
   success : function(data) {
     alert("success");
     var response = data;
     alert(response);
    });
  </code></pre>
  
  <p><strong>DivisionAction.java</strong></p>
  
  <pre><code>@Autowired
  private DivisionService divisionService;
  
  private List&lt;DivisionModel&gt; divisionList = new ArrayList&lt;DivisionModel&gt;();
  
  public String getAllDivisions() {
      divisionList = divisionService.getAllDivisions();
      return SUCCESS;
  }
  </code></pre>
  
  <p><strong>struts.xml</strong></p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;constant name="struts.devMode" value="true" /&gt;
  &lt;package name="DIVISION" namespace="/" extends="struts-default"&gt;
      &lt;action name="getAllDivisions" method="getAllDivisions" class="foo.bar.DivisionAction"&gt;
          &lt;result name="success"&gt;/jsp/users/AdminDashboard.jsp&lt;/result&gt;
      &lt;/action&gt; 
  </code></pre>
  
  <p>Response
  <a href="https://i.stack.imgur.com/O5DMF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/O5DMF.png" alt="enter image description here"></a></p>
  
  <p>All I need is the array list being returned from the action class.</p>