title: access javascript array from a php file
body: <p>How can I pass a a javascript array <code>vArray</code> to <strong>File.php</strong> , and retrieve the two values from <code>vArray</code>.</p>
  
  <p>I tried:</p>
  
  <pre><code>&lt;input type="button" id="button" onClick = "send_V();" &gt;
  
  &lt;script&gt;
  // Creat Array with Values from checkboxes
  $('input[type=checkbox]:checked').each(function() {
      vArray.push($(this).val());
  });
  
  // Set array to only 2 values ( disable checkboxes)
  var n = $('input[type=checkbox]:checked').length &gt;= 2;  
  $('input[type=checkbox]').not(':checked').attr('disabled',n);
  
  // Send array to File.php where I can manipulate its value1, and value2 to query db
  function send_V(vArray)
  {
      $.ajax({
          type: "POST",
          url: "File.php", 
          beforeSend: function () {
              $("#result").html("&lt;option&gt;Loading ...&lt;/option&gt;");
          },
          data: "vArray="+vArray,
          success: function(msg){
              $("#result").html(msg);
          }
      });
  } 
  &lt;/script&gt;
  </code></pre>
  
  <p>and on the php side ( File.php)</p>
  
  <pre><code>$value = $_POST['vArray'];
  var_dump(vArray);
  </code></pre>
  
  <p>but I am not able and sure how to manipulate a javascript variable. can someone show me a simple and effective method ?
  What is wrong in this logic?
  Thanks</p>