title: Send javascript array to server
body: <p>I have an array who's content I would like to get on my server. I have been wading through internet pages trying to find how to do this without succeeding yet.</p>
  
  <p>Let's imagine I have a server, and that I would like this array in my javascript to go into a file on my server, how would I do that?</p>
  
  <p>I have been going through internet pages looking for how to do this and I have come up with the following code:</p>
  
  <pre><code>&lt;html&gt;
      &lt;!-- installs jquery and ajax. --&gt;
      &lt;link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/&gt;
      &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"&gt;&lt;/script&gt;
      &lt;script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"&gt;&lt;/script&gt;
      &lt;script&gt;
          var arr = ["one","two","three"];
          arr = JSON.stringify(arr);
  
          $.ajax({
              url: "http://url_name_here.com",
              type: "POST",
              data: {
                  myArray : arr
              }
          });
  
          alert('hello');
      &lt;/script&gt;
  &lt;/html&gt;
  </code></pre>