twitter

Recent Comments

David Boyer
David Boyer January 13, 2012 at 10:05AM
Is Your CFLOOP Hogging Memory or Causing OutOfMemory Errors?

Interesting to find that out, wouldn't have expected it to be a problem. I've had similar...

baljit dhanoa
baljit dhanoa January 12, 2012 at 9:08AM
Creating A Recent Comments Widget With Disqus's API and PHP

Creating A Recent Comments Widget With Disqus's API and PHP good code pls try

Web Hosting Provider
Web Hosting Provider January 10, 2012 at 5:23PM
Creating A Recent Comments Widget With Disqus's API and PHP

Superb and very informative for me,,,

web hosting
web hosting December 2, 2011 at 7:28AM
If PHP's file_get_contents Function is Failing With IIS 7

I am new guy for this PHP. i get it clear idea about your topic.All the points are explained...

Aaron J. White
Aaron J. White November 14, 2011 at 11:54PM
Creating A Recent Comments Widget With Disqus's API and PHP

If you want to put the number of posts in a different area than the recent comments section...

Aaron J. White
Aaron J. White November 14, 2011 at 10:10PM
Creating A Recent Comments Widget With Disqus's API and PHP

It depends, are you using wordpress or joomla? I have a different plugin that checks disqus for...

Yulia Novozhilova
Yulia Novozhilova November 14, 2011 at 4:22PM
Creating A Recent Comments Widget With Disqus's API and PHP

very cool... it works! Do you know if it is possible to include number of total post likes on...

Aaron J. White
Aaron J. White October 30, 2011 at 10:40AM
Creating A Recent Comments Widget With Disqus's API and PHP

Hmm...It would probably help if I post a comment on my site so people can actually see my...

Using jQuery and Google Finance to Create a Simple Stock Ticker

Posted: November 17th, 2011 - I needed to create a simple stock ticker for my company's intranet portal a few days ago. I found some information on stackoverflow suggesting that you could make an ajax call to Goggle Finance and get a JSON response. I hooked it up and it works perfectly.

Here is the complete code first

$(document).ready(function() {

  $.getJSON('https://finance.google.com/finance/info?client=ig&q=NYSE:AIR&callback=?', function(response){
    var stockInfo = response[0];
    var stockString = '<div class="stockWrapper">STOCK:';
    stockString += '<span class="stockSymbol">'+stockInfo.t+'</span>';
    stockString += '<span class="stockPrice">'+stockInfo.l+'</span>';
    stockString += '<span class="stockChange">'+stockInfo.c+'</span>';
    stockString += '<span>at</span> <span class="stockTime">'+stockInfo.ltt+'</span>';
    stockString += '</div>';
    $('.stockTick').prepend(stockString);
  });
 
});
 

It's pretty simple right? Put the above code in a script tag in your page header. Just change the NYSE:AIR part in the request string to YourExchange:YourSymbol. Also, remember to put a div on the the page with css class stockTick.


blog comments powered by Disqus