title: Pass array on AJAX request using plain js?
body: <p>I'm passing an array on a POST request using jQuery, however I don't understand how to do the same with "vanilla" javascript. This is my jQuery:</p>
  
  <pre><code>    // Request using jQuery
  $.ajax({type:'POST',url:'insert-user.php',data: {myArray: myArray},
  success:function(data_response){
      console.log("jQuery, got data back, response: "+data_response);
  }});
  </code></pre>
  
  <p>This is currently how I'm trying to do it with plain js:</p>
  
  <pre><code>// Request using plain js
  var xmlhttp;
  if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
      xmlhttp=new XMLHttpRequest();
  } else {// code for IE6, IE5
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
  xmlhttp.onreadystatechange=function(){
      if (xmlhttp.readyState==4 &amp;&amp; xmlhttp.status==200){
          console.log("JS, got data back, response: "+xmlhttp.responseText);
      }
  }
  xmlhttp.open("POST","insert-user.php",true);
  xmlhttp.send({myArray: myArray});
  </code></pre>