JS jQuery each loop filter append list
<p>I am making an ajax call with grabs data which looks like this:</p>

<pre><code>{
    "cars":[{
        "id":"654",
        "type": "ford",
        "active": "1"
    },{
        "id":"650",
        "type": "fiat",
        "active": "0"
    }]
} 
</code></pre>

<p>I then use the data to populate a selectbox with this code:</p>

<pre><code>$.ajax({
    url: 'myurlhere',
    method: 'GET',
    async: false,
    success: function(result) {

        $.each(result, function(result, value) {
            $('#myselect').append($('&lt;option&gt;').text(value.id).attr('value', value.id));
        });

    }
});
</code></pre>

<p>My problem is that I only want to populate the select with data which have <strong>active = "1"</strong> (for the data)</p>

<p>So I've done this:</p>

<pre><code>$.ajax({
    url: 'myurlhere',
    method: 'GET',
    async: false,
    success: function(result) {

        if (value.active = 1) {
            $.each(result, function(result, value) {
                $('#myselect').append($('&lt;option&gt;').text(value.id).attr('value', value.id));
            });
        }

    }
});
</code></pre>

<p>but this is not filtering it and still returning all.</p>

<p>How can I fix this?</p>