How to create jQuery if statements from php array?
<p>I have array with both image colour and image id values.</p>

<p>I can echo this info, but I don't know how to get this into js file.</p>

<p>My js file is like this:</p>

<pre><code>$(document).ready(function(){

    var colour = false;
    $('.options').click(function(){
        colour = $(this).val();
        console.log(colour);
        if(colour == 'White'){
            var imageid = 758;
        }
        else if(colour == 'Black') {
            var imageid = 752;
        }
        else if(colour == 'Light Oak') {
            var imageid = 755;
        }
        else if(colour == 'Rosewood') {
            var imageid = 757;
        }
        else if(colour == 'Green') {
            var imageid = 754;
        }
        else if(colour == 'Red') {
            var imageid = 756;
        }
        else if(colour == 'Blue') {
            var imageid = 753;
        }
        else {
            var imageid = colour;
        }


        $('.options-input').val(imageid);

        console.log(this);

        $.post("index.php", { image_id: imageid }, function(results) {
            $('body').html(results);
            console.log(results);

         });    
        console.log(url);
    }); 
});
</code></pre>

<p>I am doing this manually at the moment and on click I can post imaged to my index.php</p>

<pre><code>$_POST['image_id'];
</code></pre>

<p>Works from there.</p>

<p>Problem is that I want to create js statement dynamically depending on what values new array will have.</p>
