im pritty new in writing javascript with objects. And now im trying to do an ajaxcall and have a callback function, but i can reach the callback function within the ajax call.
This is the code, how shall i call the callback function?
function smarttalkObj() {
this.base_url = 'http://';
this.getPts = function() {
$.ajax({
url: this.base_url + 'getPTS',
dataType: "jsonp",
jsonp : "callback",
jsonpCallback: "this.callback_pts",
contentType: 'application/x-javascript'
});
}
}
this.callback_pts = function(data) {
console.log(data);
}
}
smarttalk = new smarttalkObj();
smarttalk.getPts();