I am using AJAX to remove selections from a DB. These selections are listed inside of a <select> box. I am able to remove one sleection at a time, however, I am trying to be able to remove multiple selections at a time.
See code below...
Now what I would like to be able to do is get the selected values and have those become the "str" variable, as a comma delimited string. However, I haven't been able to get a loop to get all of the values to be added to the str.
any help would be great.
Thanks
See code below...
Code:
function removeCompany(profile, selBox) {
if (searchReq.readyState == 4 || searchReq.readyState == 0) {
var box = document.getElementById("Select1");
var str = '';
var val;
str = box.options[box.selectedIndex].text.replace(/&/g,"*amp*");
//alert(str);
searchReq.open("GET", 'ajaxRemove.php?t=CompanyName&p=' + profile + '&str=' + str , true);
searchReq.onreadystatechange = removeCompanySelect;
searchReq.send(null);
}
}
Now what I would like to be able to do is get the selected values and have those become the "str" variable, as a comma delimited string. However, I haven't been able to get a loop to get all of the values to be added to the str.
any help would be great.
Thanks