Hi,

Im new to javascript / AJAX and would appreciate any help with this.

I have a multiple select box and want to be able to select from this box and transfer the selection accross to a div using an "Add" button. I have this working fine but I want to append to the list, rather than replace the list when further selections are made.

I somehow need the function to remember the original selected array and then merge the new selected array and the old array if another sleection is made. I have no idea how this would be done. Any ideas welcome. This is all I have so far...

PHP Code:
function editOptions(action)
{
  var 
optionsBox document.getElementById('optionsBox');
  var 
selectedArray = new Array();
  var 
selObj document.getElementById('productOptions');
  var 
i;
  var 
count 0;
  for (
i=0i<selObj.options.lengthi++) {
    if (
selObj.options[i].selected) {
      
selectedArray[count] = selObj.options[i].value;
      
count++;
    }
  }


  var 
strURL="ajax/selected_options.php?options="+newArray;
  
  
alert(strURL);
   
   var 
req getXMLHTTP();
   if (
req)
   {
     
req.onreadystatechange = function()
     {
      if (
req.readyState == 4)
      {
         
// only if "OK"
         
if (req.status == 200)
        {
            
document.getElementById('optionsBox').innerHTML=req.responseText;
         } else {
           
alert("There was a problem while using XMLHTTP:\n" req.statusText);
         }
       }
      }
   
req.open("GET"strURLtrue);
   
req.send(null);
   }