I have 2 ajax call in 2 difference functions. I want to use .click to call these 2 functions . The func1 is inserting data in to database, then func2 is to retrieve the data
you could also pass your function as a parameter like this:
var secondFunc = function (func) {
//Do ajax req or smt
func("answer", "params");
};
var firstFunc = function() {
secondFunc(
function (answerFromFunc2, paramsFromfunc2) {
var a = answerFromFunc2;
var b = paramsFromfunc2;
}
);
//Do smt after the function request to the server is done
var doSmt = "another func or variable";
};
firstFunc();