i have a php function which returns a random json encoded color
<?php
function randNum() {
return rand(0, 255);
}
$color = array ('r'=>randNum(),'g'=>randNum(),'b'=>randNum());
echo json_encode($color);
?>
on the page i have a jquery function that whenever an event occurs, asks for a color and changes the window background accordingly
$('.wnd').mouseenter(function() {
$.getJSON("color.php", function(color){
var rgbString = 'rgb(' + color.r + ', ' + color.g + ', '+ color.b + ')';
var hexString = rgb2hex(rgbString);
$('.wnd').css('background-color', hexString);
});
});
whis works good in ff3 and chrome, but in ie8 i always receive the same color. any idea why?