I am working on a requirement which is as below.

I am storing a list of objects(each object is having a unique id) as session parameter and displaying each object data in a table in jsp using JSTL as below

```
<c:forEach var="list" items="${PlayerList}">

<tr>
        <td>
<img  style="cursor:pointer" src="./images/delete.jpg" title="Force Delete" 
onClick="forceDelete(${list.playerId})">
        <td>${list.playerName}</td>
        <td>${list.runsScored}</td>
    </tr>
</c:forEach>

```

And the AJAX function is

```
   <script>
function forceDelete(playerIdValue)
        {
            var xmlhttp;
            var toDelete= confirm("Do you want to Remove?")
            if (window.XMLHttpRequest)
            {
                xmlhttp=new XMLHttpRequest();
            }
            else
            {
                xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
            }
            xmlhttp.onreadystatechange=function()
            {
                if (xmlhttp.readyState==4 && xmlhttp.status==200)
                {

document.getElementById('display_div').innerHTML=xmlhttp.responseText;
                }
            }
            if (toDelete== true)
            {
                xmlhttp.open("POST","PlayerController?
 value="+playerIdValue,true);
                xmlhttp.send();

            }
        }
   </script>

```

I am handling the deleting row in PlayerController servlet's POST method

Now i want to implement something like below

```
<c:forEach var="list" items="${PlayerList}">

<tr>
        <td><input type="checkbox">
        <td>${list.playerName}</td>
        <td>${list.runsScored}</td>
    </tr>
</c:forEach>
<input type="button" value="delete">

```

The user can select multiple check boxes and hit the delete button then the respective rows should be deleted from JSP using AJAX

How should i proceed on this,any help would be appreciated.

If any additional data is needed, i am ready to provide.

Thanks in advance. 

I tried this but didn't seem to work,tell me where i am doing wrong.

Checkbox code `

```
<input type="checkbox" name="toBeDeleted[]" value="${list.playerId}">
<div align="center"><button onclick="forceStop()">Delete</button></div>

```

JS code

```
function forceStop()
        {
            var toBeDeleted = new Array();
            $("input:checked").each(function() {
            data['toBeDeleted[]'].push($(this).val());
            });

            $.ajax({
             url:"PlayerController",
             type:"POST",
             dataType:'json',
             data: {toBeDeleted:toBeDeleted},
             success:function(data){
            },
            });

```

`