wordpress post loop in javascript

<?php
    ob_start();
    query_posts(array('post_type' => 'topnews'));

    while (have_posts()) : the_post(); ?>
        {
            // the_title() can use a false to return the value for use with strip_tags (apparently)
            'title'         : '<?php echo stripslashes(the_title(false)); ?>',
            // Where is this $desc coming from?

            'button_list'   : [
                { 'title':'Demo', 'url' : 'http://bonchen.net/' },
                { 'title':'Download', 'url':'http://porfolio.bonchen.net/'}
            ],
            'tags'          : ['Portrait']
        }, <?php
    endwhile;
    $data   =   ob_get_contents();
    ob_end_clean();
?>
<script type="text/javascript">
    $(function(){
            <?php echo $data; ?>
        });
</script>

tech