I'm using knockoutjs and have multiple ajax calls in my project in different script files. I want to streamline the calls into one utility script and I have implemented the following:
Script File A:
function ABC(){
function myCallbackFunction(result){
///
}
$Callbacks.add(myCallbackFunction);
var UtilityObj = new ClsUtility();
UtilityObj .GetData(myJSONObj);
}
Script File B:
function ClsUtility(){
function GetData(myJSONObj){
$.ajax(
////
success: $.Callbacks.fire(result);
);
}
}
The callback function is not getting called. Help me find out the solution.
Thanks, Rahul Adwani
You may remove parenthesis like :
success: $.Callbacks.fire
that's equivalent to :
success: function(result){
$.Callbacks.fire(result);
}
but you can't set a pointer function with parenthesis