I Have the following function.
function ChangeDasPanel(controllerPath, postParams) {
$.post(controllerPath, postParams, function(returnValue) {
$(
You know that global variables and functions are evil, so why not put your's into the jQuery namespace:
$.extend({
myFunc : function(someArg, callbackFnk){
var url = "http://example.com?q=" + someArg;
$.getJSON(url, function(data){
// now we are calling our own callback function
if(typeof callbackFnk == 'function'){
callbackFnk.call(this, data);
}
});
}
});
$.myFunc(args, function(){
// now my function is not hardcoded
// in the plugin itself
});
Read this post to get a better understanding: Creating callback functions in jQuery