i need to append some php codes in a < script > in a php file. my codes works Properly, but i think that's mistake! i hear somethings about ajax and etc... its my codes mistake? if yes what is should to do? thank you so much
<script>
jQuery(document).ready( function() {
var button = jQuery('.button');
var sample = jQuery('.sample');
var geturi = '<?php echo get_template_directory_uri(); ?>';
var category = '< ?php foreach ( $terms as $term ){ echo '<option value="'. $term->slug .'">'. $term->name .'</option>'; } ?>';
button.live( 'click', function() {
sample.append('<li><div>'+ geturi + '/img.png' +'</div><select>'+ category +'</select><?php _e( 'sample', 'sample' ); ?></li> and more...');
});
</script>