Skip to content

Instantly share code, notes, and snippets.

@jennifert
Created February 4, 2016 17:53
Show Gist options
  • Save jennifert/285154cbb71c1911b94f to your computer and use it in GitHub Desktop.
Save jennifert/285154cbb71c1911b94f to your computer and use it in GitHub Desktop.
Basic YQL Call
//declare vars
var blogLink = 'https://query.yahooapis.com/v1/public/yql?q=' + encodeURIComponent('select title,link,pubDate,category from rss where url ="http://rss.cbc.ca/lineup/technology.xml"')+'&format=json&diagnostics=false&callback=?';
//end variable declare
jQuery.noConflict();
jQuery(document).ready(function($){
//Call blog feed
$.getJSON(blogLink, function(data){
$.each(data.query.results.item, function(index, item){
$('.blog-post-container' ).append('<div class="row">');
$('.blog-post-container' ).append('<div class="col-md-12">');
$('.blog-post-container' ).append('<h2 class="blog-header"><a href="'+item.link+'" target="_ blank">'+item.title+'</a></h2>');
$('.blog-post-container' ).append('<p class="blog-summary">Category: '+item.category+'<br>Date: '+item.pubDate+'</p>');
$('.blog-post-container' ).append('</div>');
$('.blog-post-container' ).append('</div>');
});
});
//end blog feed
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment