0

I'm using from kcfinder in my web page it is ok but only one problem; i need to separate callback function and use it further ...but i can't

function openKCFinder(div) {
window.KCFinder = {
    callBack: function(url) {
///all action 
}

//i need something similar this ///it is not work;

function set_pic(url,div){
    ///all action
}
function openKCFinder(div) {
  window.KCFinder = {
    callBack: set_pic(url,div) ;
 }

thanks for help me.

and excuse me for poor English.

3 Answers 3

2

Your current code runs set_pic(url,div) right away; its return value is assigned to callback. Try: callback: function(){ set_pic(url, div); }

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

Comments

1

Just make another function:

   callback: function(url) { set_pic(url, div); }

Comments

0

You can follow this code hopefully solved this issue

function set_pic(url, div,callBack) {

    callBack(div)
}

function openKCFinder(div) {
    window.KCFinder = {
        callBack: set_pic(url, div)
    }
}

set_pic('passing url','passing div', openKCFinder(div))

Comments

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.