Jquery ajax with js class [solved]

Jquery ajax with js class [solved]

Hi,

I have a problem in my project. All my JS source have been write in class and when i execute an ajax query with jquery i lost my object in succes callback function.

here is an example :

var _mf = {};

_mf.myClass = function() {
   this.testVar   = 'bar';
}

_mf.myClass.prototype = {
   getData: function(id) {
      $.ajax({
            url: 'http://www.mywebsite.com/getdata/',
            data: 'id='+id,
            success: this.getDataCallback,
            type: 'POST',
            dataType: 'json',
            cache: false,
            async: false
         });
   },
   getDataCallback: function(data, textStatus) {
      alert(this.testVar); // return "undefined"
   }
}

var obj = new _mf.myClass();
obj.getData(1);



How can i keep my object on callback function.

Thanks for your help,


ps: sorry for my english :p