How you can make this more efficient, imagine a method that you don't know how much parameters you'll need.
For example a simple ajax insert, but you don't know how much inputs has the html... so then you need to send for example 4 will be like this one:
function insert_these(data1, data2, data3, data4){
$.post( 'test.php', { dat1: data1, dat2: data2, dat3: data3, dat4: data4 );
};
But, if you want more than 4 inputs?
How you can make a function with a parameters as a array, something like this:
inputs = new array();
function insert_these(inputs){
//then the rest of code
$.post( 'test.php', for (var i = 0; i < inputs.lenght; i++){
dat+i: inputs+i, }; );
};