8 success: function(data
){
9 $(".loading").text("Loading...");
11 $(".loading").text("Data can't be loaded due to some error");
15 if(isLoadingFirstTime()){
16 var arrayOfQuotes
= new Array();
18 var baseuri
= "http://www.stockbangladesh.com/company_details.php?code=";
19 $.each(data
.exchanges
, function(i
, se
){
20 $.each(se
.quotes
, function(j
, x
){
21 arrayOfQuotes
[index
] = $(".savedExchange").clone(true);
22 arrayOfQuotes
[index
].addClass("exchange");
23 arrayOfQuotes
[index
].removeClass("savedExchange");
24 arrayOfQuotes
[index
].children(".companyLink").children(".exchangeHyperlink").attr("href", baseuri
+x
.company
.symbol
);
25 arrayOfQuotes
[index
].children(".companyLink").children(".exchangeHyperlink").children(".companyName").text(x
.company
.symbol
);
26 arrayOfQuotes
[index
].children(".value").text(x
.value
);
27 arrayOfQuotes
[index
].children(".lastPrice").text(x
.lastPrice
);
28 arrayOfQuotes
[index
].children(".high").text(x
.high
);
29 arrayOfQuotes
[index
].children(".low").text(x
.low
);
30 arrayOfQuotes
[index
].children(".changePercentage").text(x
.changePercentage
);
31 arrayOfQuotes
[index
].children(".trade").text(x
.trade
);
32 arrayOfQuotes
[index
].children(".volume").text(x
.volume
);
33 arrayOfQuotes
[index
].children(".version").text(x
.version
);
34 var d
= new Date(x
.quoteTime
);
35 arrayOfQuotes
[index
].children(".quoteTime").text(getDateString(d
));
36 arrayOfQuotes
[index
].children(".quoteTimeNumber").text(x
.quoteTime
);
37 arrayOfQuotes
[index
].attr("id", x
.company
.symbol
);
42 for (i
=0;i
<index
;i
++){
43 arrayOfQuotes
[i
].show();
44 arrayOfQuotes
[i
].appendTo("#exchanges");
46 $(".savedExchange").remove();
48 $(".loading").text("");
51 $.each(data
.exchanges
, function(i
, se
){
52 $.each(se
.quotes
, function(j
, x
){
53 $("#"+x
.company
.symbol
).children(".value").text(x
.value
);
54 $("#"+x
.company
.symbol
).children(".lastPrice").text(x
.lastPrice
);
55 $("#"+x
.company
.symbol
).children(".high").text(x
.high
);
56 $("#"+x
.company
.symbol
).children(".low").text(x
.low
);
57 $("#"+x
.company
.symbol
).children(".changePercentage").text(x
.changePercentage
);
58 $("#"+x
.company
.symbol
).children(".trade").text(x
.trade
);
59 $("#"+x
.company
.symbol
).children(".volume").text(x
.volume
);
60 $("#"+x
.company
.symbol
).children(".version").text(x
.version
);
61 var d
= new Date(x
.quoteTime
);
62 $("#"+x
.company
.symbol
).children(".quoteTime").text(getDateString(d
));
63 $("#"+x
.company
.symbol
).children(".quoteTimeNumber").text(x
.quoteTime
);
66 $(".loading").text("");
70 error: function(error
){
71 $(".loading").text("Data can't be loaded due to some error");
77 var symbol
= $(".symbol").text();
78 var fulluri
= "/api/latest/" + symbol
+ ".json";
79 var uri
= "/api/exchange/" + symbol
+ ".json?";
81 var numberVisible
= 0;
83 if(isLoadingFirstTime())
85 $(".companyName").each(function(){
86 if($(this).parents(".exchange").is(":visible")){
92 uri
= uri
+ "tickr=" + $(this).text();
97 if(numberVisible
> total
/2 || numberVisible
== 0){
104 function isLoadingFirstTime(){
106 $(".exchange").each(function(){