in reply to Ajax to refresh array

You'll need to store the array-in-progress somewhere (session, database, hidden DOM elements in your AJAX replies...) because each AJAX transaction is an independent HTTP request, meaning that your environment does not automatically carry over from one to the next.

The basic structure of your AJAX handler, then, will be something along the lines of:

retrieve previous set of values add new user-submitted value to the set store new set of values send an HTML snippet back for CGI::Ajax to insert into the page
If you show some of your current code, we can provide more detailed advice, but perhaps that brief outline will be enough to get you going.