Take the 2-minute tour ×

I've got the following situation:

// callback function for the asynchronous call
function get_data_cb(z, arg1) {
    // do something

function foo() {
    var n = 1;
    // get_data is a server-side function triggered by the AJAX call, 
    // client only has the wrapper function with the same name
    get_data(get_data_cb);  // 1

My question:

At 1), how do I pass variable n all the way to get_data_cb? I'm using sajax_export() on the server-side ajax function to produce a client-side wrapper.

share|improve this question
Does n have to go to the back end, is n always an integer? –  SOliver Dec 4 '12 at 15:08
Nah, it's just an example. Although it will be an int in my case. P.s. it's not going to the back end, it's going to the callback. –  Robotron Dec 4 '12 at 15:14

Your Answer



Browse other questions tagged or ask your own question.