I have a homepage that calls out to an xml feed using jquery ajax. It takes a couple seconds to get the feed. I'd like users to be able to navigate away from the page before the ajax call is done.
JS:
$(document).ready(function() {
$.ajax({
dataType: 'html',
url: '/home/get_feed'
}).done(function(data){
$('#feed_data_area').html(data);
});
});
Controller:
def get_feed
@feed = Feedjira::Feed.fetch_and_parse('http://www.genericwebservice.com/feed')
render :partial => 'feed_data', :locals => {:feed => @feed}
end
Is this something I have to do in the js, or is there a rails way to interrupt the controller?
Thanks for any help.