Covert WordPress Blogname into JQuery

Use wp_localize_script

function set_js_var() {
  $translation_array = array( 'blog_name' => get_bloginfo('name') );
  wp_localize_script( 'jquery', 'my_data', $translation_array );
}
add_action('wp_enqueue_scripts','set_js_var');

If you look at the source of the page you will see something like:

<script type="text/javascript">
/* <![CDATA[ */
var my_data = {"blog_name":"WordPress 3.5.1 Release"};
/* ]]> */
</script>

That is your Javascript variable.

You have to “register” that on some existing Javascript slug. That is, some slug you’ve already used to register a script. That is why I used jquery, which is the slug used by WordPress to load its bundled jQuery library.