Echo从javascript解析PHP数据?

I'm trying to create an auto-refreshing RSS ticker feed, where response.php parses the RSS feed, and the HTML file displays the output.

Here's the javascript that's in the HTML file.

<script type="text/javascript" charset="utf-8">

    (function worker() {
        $.get('response.php', function(title) {
            $('.result').html(title);
            setTimeout(worker, 2000);
        });
    })();
</script>

And here's the Response.php.

<? 
require_once('magpierss-0.72/rss_fetch.inc');
$rss = fetch_rss ('http://steamcommunity.com/groups/rsstest/rss');
$item = $rss->items [0]; 
$title = $item[title];
echo $title
?> 

Currently, the javascript parses response.php every two seconds, however I'm clueless as to echoing $title from javascript. Ideally, the current text would be replaced on parsing new information, and would output to a div.

If $title is just text change

$('.result').html(title);

to

$('.result').text(title);

You may also consider turning the response into JSON so then later when you decide to add more to it you're good to go. Then use the getJSON function in Jquery