Recently in the company to make a presentation, and then the leader asked to add some stock of real-time data display.
At first, my colleague gave me a URL to aggregate data that I could get from it. I look, yo Ah, API interface and so on all provided, really convenient. Then want to use the time only to find, first to register, and then according to the use of the number of members or something, there are some audit process, all of a sudden feel good trouble!
Later, different colleagues said Sina also has real-time stock data, there are interfaces. I checked it out, just right.
Before the code first thanks to the next blog Park a predecessor to provide experience, his blog on the Sina stock data interface made a more detailed description.
Http://www.cnblogs.com/luluping/archive/2010/11/15/1877817.html
But he did not provide a simple example, he wrote in the article has an example I also tried to do, make the foggy, so I simply check the data to study the next.
Not much to say, the following is a simple demo of Ajax calls, for reference only. (Get multiple stock data, and each value in the return value represents the meaning of these, please refer to the above mentioned previous blog, not explained here)
$.ajax ({ "GET", "http://hq.sinajs.cn/list=sh601006", "script", "false", +, function(data, Textstatus, JQXHR) { Console.log (hq_str_sh601006); var str = hq_str_sh601006.split (","); Console.log (str); Console.log (str[3]); }, function() { alert ("Error! "); }});
Ajax gets real-time stock data from Sina