i am trying to add the posts from my word press blog to a javascript array however it keeps adding a new line and causing errors in the javascript. here is the code
<?php $num = 0 ; require($_SERVER['DOCUMENT_ROOT'] . '/blog/wp-load.php');query_posts('showposts=3');if (have_posts()) : while (have_posts()) : the_post(); ?> news_content[<?php echo $num; ?>]="<a href='<?php the_permalink(); ?>' title='<?php the_title(); ?>'><?php the_title(); ?></a>Posted on <?php the_time('l jS F, Y') ?><?php the_excerpt(); ?>";<?php $num = $num + 1; endwhile; else: echo "no posts"; endif; ?><?php wp_reset_query(); ?>
the_excerpt();
keeps returning <p>post</p>
and a new line, causing a error
How can i get rid of the new line?