I have a checkbox list of items. I need to update my database to which items were selected. The list of items is displayed dynamically.
The problem is how can i pass list of ID's through ajax?
here is my ajax code:
function update(form,div,PhpFile,type)
{
if (request)
{
var obj = document.getElementById(divId);
request.open("POST",PhpFile);
//setting the header
request.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
request.onreadystatechange = function()
{
if (request.readyState == 4 &&
request.status == 200){
obj.innerHTML =request.responseText;
}
}
if(type=='news')
request.send(?????);
}
}
I've marked with ??? the space that I don't know what to put there.
Of course I can update each of the check boxes individually but it is a very bad solution.