title: How to send js array in Ajax
body: <p>I have created a JS array like this <code>var detailsArr = new Array();</code> and pushing some data into this array.</p>
  
  <p>Now i push this array via Ajax to my Spring Controller like this </p>
  
  <pre><code>$.ajax({
              type: "POST",
              url: "submit",
              data: ({detailsArr : detailsArr }),
              success: function(html){
                alert( "Submitted");
                  }
            });
  </code></pre>
  
  <p>At the Spring Controller side ,  i receive this array through the <code>@RequestBody</code> annotation. The Spring Controller method signature looks like this</p>
  
  <pre><code>public String submit(@RequestBody String body) 
  </code></pre>
  
  <p>But the array when received at the Spring Controller side is basically a String of this format</p>
  
  <pre><code>detailsArr[]=add&amp;detailsArr[]=test1&amp;detailsArr[]=test2&amp;detailsArr[]=test3
  </code></pre>
  
  <p>I have to manually split this String to get the values, this is a cumbersome process. Is there any way in which I can get the array as it is , so that I just have to iterate over it to get the values.</p>