pass array into inline function

pass array into inline function

Hello

i am taking all the input element's Id at document.ready() and keeping it as an array

var allIds = new Array();
$("input").each(function(){
allIds.push(this.id);
});

var allPrevVals = new Array();
for(i=0;i<allIds.length-1;i++) {
allPrevVals.push($("#"+allIds[i]).val());
}

and when i tried to get the same array in an Inline function it get fails

$("#update_btn").click(function(){
alert(allPrevVals.length);
});
how i can pass that array into that inline function

Please help
Regards
Anees