make_complicated_post({ parameters: {}, some_var: 'abc', callbk: function(){ alert('ima callback'); } }); function make_complicated_post(args){ "use strict"; if (!args.hasOwnProperty('some_var')) { args.some_var = ''; } if (!args.hasOwnProperty('parameters')) { args.parameters = {}; } $.post( 'mysite.dev/ajax/'+args.some_var, args.parameters, function(data){ args.callbk;//не вызывается, хотя как строка она тут есть. Eval не хочется }, 'json' ); } 

Question: how do you pass the function through the parameter?

    1 answer 1

    Can args.callbk() ?

    • =) It is the same. - knes
    • @knes Pascal habits? - alexlz
    • Nope, javascript. = / There, when transferring, the brackets are not placed, but for some reason I was wiped out, that since there is also a transfer to the post () function, it is also necessary without brackets. - knes
    • @knes so in the transfer like nowhere not put. But the call of functions / procedures without parameters is just a name without brackets and the semicolon is algol / pascal. - alexlz pm