Messy code issues aside, this:
<?php $output ?>
Should be:
<?php echo $output ?>
Also note that your JavaScript html() function will need a string, which means quotes around the HTML. Something like:
$('#Result').html("<?php $output ?>")
But then if your PHP $output has quotes in it, that'll break. So then you'll need to look at addslashes().
While this should fix your current issues, the commenters are right that this is a horribly messy/ugly way to write code, you need to refactor this significantly.
Suggestion: One way to make this a bit cleaner would be like this:
// At the top of your page
<?php
$output = '';
foreach( $votes as $array) {
    if($array->color === $colors->color) {
        $output .= $array->votes . '<br>';
    }
}
?>
// Down in your HTML code somewhere
<div id="output" style="display:none"><?php echo $output ?></div>
// Now for the much simpler javascript
<script>
    $('#tes').click(function(){
        $("#output").show();
    });
</script>
This way you have minimal mixing of PHP with HTML/JS, you don't have to worry about escaping quotes, the PHP $output is already on your page (hidden) ahead of time, and JavaScript just has to show it.