0

I am trying to call a function typed variable from jQuery code. But don't know how to do that. eval() takes string input but I have function typed variable. I have tried the following code

if($.isFunction(successCallback)){
    window[successCallback]();
}
4
  • $.isFunction(errorCallBack) is working perfectly. It gives me true but I am not able the call that function @Satpal Commented Apr 9, 2015 at 7:53
  • What is this: window[errorCallBack]();? Commented Apr 9, 2015 at 8:05
  • @mmgross I was trying call the errorCallBack as this is function typed variable. I am able to do that using errorCallBack.call() Commented Apr 9, 2015 at 8:11
  • I'm voting to close this question as off-topic because the question has been updated to the point that there isnt a problem to fix anymore Commented Apr 9, 2015 at 8:29

1 Answer 1

1

Calling like a normal function worked.

successCallback()

Sign up to request clarification or add additional context in comments.

1 Comment

@atmd Looks like I was doing silly mistakes. Thanks man. It worked. Updated answer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.