I have a pop up dialog box and I am trying to make it as dynamic as I can so I can send to it any function I want. I wanted to create a callback function so I can pass any function I want and it will do whatever I need on my object (in this example just print something for testing it.
here is what happens when the pop up is being called:
function DisplayPopUp(obj, callback) {
//On Action Clicked
$('#actionButton').click(function(e){
e.preventDefault();
callback(Obj);
});
}
And here is the function that activates the PopUp function
$('.delete').click(function(){
var obj="something something";
DisplayPopUp(obj,function(){console.log('going to delete');});
});
Somehow that doesn't work and I get from firebug this error:
Obj is not defined
Clearly I do not transfer my function right - how should I do it?