【发布时间】:2012-06-21 13:16:45
【问题描述】:
我已经编写了 ETF 类。这是在 javascript 中用 OOP 编写的尝试。
该类称为 ETF。方法是getData和draw。 我正在尝试从方法“getData”访问方法“draw”
function ETF(){
//global variable
}
//class methods => getData (from xml file), draw(draws the bar )
ETF.prototype ={
getData: function(is_load, DateDiff){
$.getJSON(
"server/ETF.server.php",{
mycase: 1
},
function(data){
lng_pr = data.longs_prec;
sh_pr = data.shorts_prec;
ETF.draw(lng_pr, sh_pr); // <== how to access the draw method?
});
},//end getData
//draw the
draw: function(lng_pr, sh_pr){
//draw code..
}
尝试了“this.draw”但没有任何效果..
有人吗?
【问题讨论】:
-
请详细说明
ETF类、draw方法应该做什么以及遇到什么错误。 -
你希望别人怎么理解你在这里想要做什么?
-
我正在尝试从方法“getData”访问方法“draw”
标签: javascript oop methods