I need some advice.
This is my problem, I have the "N" function.
var FirstOne = function(){
return $.ajax({
type: "POST",
url: hrefUrl,
data: JSON2.stringify(option),
contentType: "application/json; charset=utf-8",
dataType: "json",
error: function(status){
},
success: function(data){
}
});
};
var SecondOne = function(){
return $.ajax({
type: "POST",
url: hrefUrl,
data: JSON2.stringify(option2),
contentType: "application/json; charset=utf-8",
dataType: "json",
error: function(status){
},
success: function(data){
}
});
};
.............
var NOne = function(){
return $.ajax({
type: "POST",
url: hrefUrl,
data: JSON2.stringify(optionn),
contentType: "application/json; charset=utf-8",
dataType: "json",
error: function(status){
},
success: function(data){
}
});
};
all of these arr functions are placed in the object that is this.
var funcObject= [FirstOne(), SecondOne(), ....... NOne() ];
after I wait for all Ajax functions to be executed with and after that, I'm fine.
$.when.apply($, funcObject).done(function (a1, a2, ...an) {
});
my problem is here:
function (a1, a2, ...an)
I want to have an object instead of the arguments of the function, because I do not know how many functions there will be.
So, I can edit the function object, which is cool $.when.apply($, fucArr), the problem is using variable numbers of arguments.
PS: Maybe I can use "apply" or "call" for these arguments?
Can someone give me an idea here. Thanks a lot of guys !!!