How to return multiple values in an AJAX call?
<p>Let's say I would like to output two different types of data to two of my divs, <code>#count_boys</code> and <code>#count_girls</code>. For the sake of clarifying my goal I have added <code>data.boys</code> and <code>data.girls</code> to my html call. Not that it works, but it hopefully clarifies what I am trying to achieve. </p>

<p>Let's assume that I have boys and girls in my database as table columns in my MySQL DB. </p>

<pre><code>function countlist() {
    var generic;
    $.ajax({
        method: "GET",
        url: "ajaxcalls/numbercall.php?",
        data: generic,
        success: function(data) {
            //general contractors//
            $('#count_boys').html(data.boys);
            $('#count_girls').html(data.girls);
        } 
    });
}
</code></pre>

<p>Now, my <strong>numbercall.php</strong> looks something like this:</p>

<pre><code>&lt;?php
$con = mysqli_connect('localhost', 'root', '', 'coolkidsclub');
$query = mysqli_query($con, "SELECT * FROM members");

$num = mysqli_num_rows($query);
echo "$num";
mysqli_close($con);
?&gt;
</code></pre>

<p>I understand that using a PHP encode would be the way to go about this. But I'm not entirely sure how to go about using it. </p>