大佬教程收集整理的这篇文章主要介绍了如何在Javascript中从另一个成员函数调用成员函数,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
function Chart(start,end,controller,method,chart) { console.log('Chart constructor called'); this.start = start; this.end = end; this.controller = controller; this.method = method; this.chart = chart; this.options = {}; } Chart.prototype.update = function() { console.log('update ' + new Date().getTime()); $.getJSON('index.php',{ controller: this.controller,method: this.method,START: this.start,END: this.end },function(json) { this.draw(json); }); //<-- Problem right here! } Chart.prototype.draw = function(json) { //lots of code here }
我收到错误Uncaught TypeError:Object#< an Object>没有方法’画’.现在,我是第一个承认我对Javascript很新的人.我应该以另一种方式调用成员函数吗?或者我应该做一些完全不同的事情?
编辑:这是我创建对象的方式:
chartObj = new Chart(开始,结束,’OBF.RootCauses’,’ajaxRootCauses’,图表);
以上是大佬教程为你收集整理的如何在Javascript中从另一个成员函数调用成员函数全部内容,希望文章能够帮你解决如何在Javascript中从另一个成员函数调用成员函数所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。