请教封装jquery在类中的this为什么不能访问?

aaaa1861 2009-01-07
用javascript写一个类
function Bill(bid)
{
    this.strVal="abc";             
}

Bill.prototype.getDataed=function(xml)
{
   alert(this.strVal);   //这里呈示为undefined
}
Bill.prototype.getData=function()
{
   $.ajax({
              type: "GET",
              url: "../Service/test.aspx",
              data:"TypeID=0&bid=1"
              dataType: "xml",
              async:false,
              cache:false,
              success: function(xml) {
                this.getDataed(xml);
              },
              error: function(data) {
                alert(data);
              }
          });
}

调用getData后,代码正常运行,
进入getDataed后,弹出的值为什么是undefined而不是abc?
请问如何解决调用类的this的变量?
Global site tag (gtag.js) - Google Analytics