I have a js class that contains many functions which proceed_data() contains Jquery $.post function and callback(function (data)) does not allow to access preload() class and constructor class in its own.
Please assist me, thanks.
class GridDisplay {
constructor(current_page){
this.current_page = current_page;
this.csrf_token = "ABCDE"
}
preload(x, y){
return(x+y);
}
proceed_data(){
$.post("/api/",
{'csrfmiddlewaretoken' : this.csrf_token,
'page_no' : this.current_page,
function (data) {
grid_item = this.preload(data.x, data.y)
}
})
}