title: Pass php array to ajax
body: <p>I have this array:</p>
  
  <pre><code>    $users = array();
  // Finally, loop over the results
  foreach( $select as $email =&gt; $ip )
  {
      $users[$email] = $ip;
  }
  </code></pre>
  
  <p>Now i want to pass this array to ajax and print in another script:</p>
  
  <pre><code>$html="&lt;center&gt;&lt;a href=\"#\" id=\"check_spam\" onclick=\"$.ajax({type: 'POST', url: 'mcheck.php', data:'users=$users', success: function(data){ $('#results').html(data);}});\"&gt;Check users for spam&lt;/a&gt;&lt;/center&gt;";
  </code></pre>
  
  <p>mcheck.php</p>
  
  <pre><code>echo $_POST['users'];
  </code></pre>
  
  <p>This code does not work. How can i do this?</p>