I have the following code, in a prototype and I would like to pass in the callback functions (successf, failuref) from where the instance of Data is created. This does not seem to get called though, any help appreciated. It all works fine if defined in the main application obviously and if I use async: false it also works but I would like to do asynchronous...
Callbacks are declared as follows,
function bdsuccess( data, textStatus, jQxhr ){
...
};
function bdfailure( jqXhr, textStatus, errorThrown ){
...
};
//invocation...
var pd = new Data();
pd.getdata('/resolve', 'test', bdsuccess, bdfailure);
Prototype is as below...
function Data() {
}
Data.prototype.getdata = function(route, req, successf, failuref) {
var ps = new Support();
var bddata = ps.b64enc(req);
var res;
$.ajax({
url: route,
type: 'POST',
contentType: false,
async: false,
data: {bd: bddata},
success: successf,
error: failuref,
});
return res;
}