javascript - passing arguments to callback -
how can pass arguments callback function in specific scenario.
i have function gets object callbacks this
function dosomething({ callbacksuccess : myfunction, callbackerror : myotherfunction})
how can pass arguments myfunction or myotherfunction?
like, if myotherfunction gets msg parameter this
function myotherfunction(msg) { alert(msg); }
thanks in advance
simplest of all:
function dosomething(callback) { //some code-poetry; callback(1, 2, 3); //the callback back!!! } function foo(a, b, c) {//this callback alert("i got parameters") } dosomething(foo); //the function call
best explanation callback function:check this
a simple defination be:the callback function called @ point in future when code or function completes execution.
Comments
Post a Comment