Ajax和Django

I have a jquery ajax code that looks like below,Its working on a delete button and a checkbox.

$(".delete-row").click(function(){
                    $("table 
 tbody").find('input[name="record"]').each(function(){
                        if($(this).is(":checked")){
                                        var value = $('chk').val();
                        $(this).parents("tr").remove();
                                        $.ajax({
                                            url: "/delete/",
                                          //  type: "post", // or "get"
                                            data: value
                    });
                });
            });
            });

This jquery call should delete the checked row in a table and the added ajax call will call a django view.

My doubt is I am passing the checkbox value to django view in the above AJAX call. In this case how do django view come to know what table row to delete based on the checkbox value?

below is how my table is getting created in a for loop

{% for x in dirs %}
                       <tr id='this_row' style="text-align: center;">
                                  <td>

                                            <input type="checkbox" id="chk" value="this_row" name="record"></td>


                          <td>
                              <a href="/contents?query_name={{ x|urlenchode }}" id="this_row1" style="text-decoration: none;">{{ x.name }}</a>
                          </td>
                                    <td>
                              {{ x.created_date }}
                          </td>
                                    <td>
                              {{ x.description }}
                          </td>
                       </tr>
                     {% endfor %}

below is the delete button

<button type="submit" name="erase" class="delete-row">Delete Row</button>

Just add the id of the row as value attribute to the checkbox, so your ajax will send a list of ID. Instead of this_row, add {{x.id}} the instance id

{% for x in dirs %}
    <tr id='tr-{{x.id}}' style="text-align: center;">
        <td><input type="checkbox" id="chk-{{x.id}}" value="{{x.id}}" name="record"></td>
       <td>
       <a href="/contents?query_name={{ x|urlenchode }}" id="link-{{x.id}}" style="text-decoration: none;">{{ x.name }}</a></td>
       <td>{{ x.created_date }}</td>
       <td>{{ x.description }}</td>
    </tr>
{% endfor %}

And in your ajax, you have access to it with

// send this array via ajax
$(".delete-row").click(function(){
   var id_list = new Array();

   $("input[name=record]:checked").each(function(){
       id_lists.push($(this).val()); 
       $(this).parent("tr").remove(); // Remove the row,
       // the correct is parent() without 's', not parents()
   });

   // with type:'post', don't forget the csrf_token
   $.ajax({
       url: "/delete/",
       type: "post",
       data: {
          id_list:id_list,
          csrfmiddlewaretoken:"{{ csrf_token }}"
       },
   });
});

And in your view, you can retrieve the id_list containing all the selected rows with reqest.POST.getlist('id_list[]'). In case it was a GET request reqest.GET.getlist('id_list[]')