I have array with both image colour and image id values.
I can echo this info, but I don't know how to get this into js file.
My js file is like this:
$(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);
});
});
I am doing this manually at the moment and on click I can post imaged to my index.php
$_POST['image_id'];
Works from there.
Problem is that I want to create js statement dynamically depending on what values new array will have.
json_decode$colourcome from?