I have this jquery function
function example(file, targetwidget, callback){
$(targetwidget).load(file, {limit: 25}, function(){
$(\"#widget_acco
Since you are passing a text string you would need to eval it:
function example(file, targetwidget, callback){
$(targetwidget).load(file, {limit: 25}, function(){
eval(callback);
});
Edit:
if you want to use call() you would have to do it like this:
function callback() {
$("#widget_accordion").accordion({fillSpace: true});
}
function example(file, targetwidget, callback){
$(targetwidget).load(file, {limit: 25}, function(){
if(typeof(callback)==='function'){
callback.call(this);
}
});
example('http://example.com/', "#divid", callback);
In order for call to work, you would have to pass a function and not a string. But by wrapping your jQuery expression inside of a function, it would be run when the function is called. Calling a function can be done with the .call() method.