# AJAX does not work correctly

**URL:** <https://forum.djangoproject.com/t/ajax-does-not-work-correctly/19105>\
**Category:** Templates & Frontend\
**Created:** [February 25, 2023, 2:09pm UTC](https://forum.djangoproject.com/t/ajax-does-not-work-correctly/19105 "2023-02-25T14:09:19Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pisych72](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/pisych72/32/12402_2.png) [@Pisych72](https://forum.djangoproject.com/u/Pisych72)\
**Post date:** [February 25, 2023, 2:09pm UTC](https://forum.djangoproject.com/t/ajax-does-not-work-correctly/19105/1 "2023-02-25T14:09:19Z")

</div>

Hi! Sorry for the bad English…Here’s the problem…Here is the code using ajax to add and remove records to the table. If you open a page with data, you can both delete and add… But! after adding, deleting does not work… the id value becomes ". But if you refresh the page, everything works again. Can you tell me what the reason is?

```auto
<script>
 output='';
 
$('#post-form').on('submit',function(e){
event.preventDefault();
var self = this;
let _tlt=$("#idtitle").val();
 
let csr=$("input[name=csrfmiddlewaretoken]").val();
console.log($(this).attr('action'))
mydata={
title:_tlt,
csrfmiddlewaretoken:csr,
}
 
$.ajax({
url:$(this).attr('action'),
method:"POST",
data:mydata,
dataType:"json",
 
success:function(data){
    x=data.unit_data;
    if (data.status=='Save'){
    for(i=0;i<x.length;i++){
    output +='<tr><td class="align-middle" style="width:960px;">'+ x[i].title+'</td>'+
    '<td class="text-center align-middle">'+'<input data-sid="{{item.pk}}" value="Update" type="image" src="../static/images/update.png" style="width:25px;">'+'</td>'
    +
    '<td class="text-center align-middle">'+'<input data-sid="{{item.pk}}" data-del="{{url_delete}}" class="btn-del" value="Delete" type="image" src="../static/images/del.png" style="width:28px;">'+'</td></tr>'
    }
 
    $('#tbody').html(output)
    output='';
    $("form")[0].reset();
    //location.reload();
    }
    if (data.status == 0){
    alert('Запись не добавлена. Возможно, такая уже есть в справочнике...');
    }
}
});
}
);
///////////////////////////////////////////////////////////////////////////////
/////////////////////////////Delete SPR
$('#tbody').on('click','.btn-del',function(){
let id=$(this).attr('data-sid');
alert(id);
let pth='/'+$(this).attr('data-del')+'/';
let csr=$("input[name=csrfmiddlewaretoken]").val();
 
mydata={sid:id, csrfmiddlewaretoken:csr,};
mythis=$(this);
$.ajax({
url:pth,
method:'POST',
data:mydata,
success:function(data){
if(data.status =='Del'){
$(mythis).closest("tr").fadeOut();
 
}
 
if(data.status ==0){
console.log('NO');
}
},
});
 
});
 
</script>

```

View here:

```auto
def SprDelete(request):
    if request.method == 'POST':
        id=request.POST.get('sid')
        print(id)
        pi=Unit.objects.get(pk=id)
        pi.delete()
        return JsonResponse({'status':'Del',})
    else:
        return JsonResponse({'status':0,})

```

```auto
def UnitList(request):
   unit = Unit.objects.all()
   form=UnitForm()
   return render(request,'store/spr/SprList.html',{'title':"Единицы измерения",
   'unit':unit,'form':form,'pic_label':'Единицы измерения','url_name': reverse('SprSave'),
   'url_delete': reverse('SprDelete'),})

```

HTML page:

```auto
{% extends 'store/menu.html' %}
{% load static %}
{% block DataArea %}

<div class="row">
    <div class="col-md-1 ">{{pic_label}}</div>
<div class="col-md-11 mx-auto shadow">
<table class="table shadow ">
 <thead>

    <tr>
      <th >
<form action={{url_name}} method="post" id="post-form">
        {% csrf_token %}
        {{ form.as_p}}</th>
<th class="pt-4 "> <button type="submit" class="btn btn-primary btn-sm mb-3 pt-2 pb-2 " id="savebtn">Добавить</button>

</form>
</th>
    </tr>
  </thead>
</table>
<div class="scrolltable">
<table class="table shadow table-bordered">
<tbody id="tbody">
    {% for item in unit %}
<tr>
<td style="width:960px; " class="align-middle">{{item.title}}</td>

<td class="text-center align-middle" ><input data-sid="{{item.pk}}" value="Update" type="image" src="{% static '/images/update.png' %}" width="25px" > </td>
<td class="text-center align-middle" ><input data-sid="{{item.pk}}" data-del="{{url_delete}}" class="btn-del " value="Delete" type="image" src="{% static '/images/del.png' %}" width="28px"> </td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
<script>
     var PictureDeleteUrl="{% static '/images/del.png' %}"
     var PictureDeleteUrl="{% static '/images/update.png' %}"
</script>
{% endblock DataArea %}

Thanks!

```

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [February 25, 2023, 3:14pm UTC](https://forum.djangoproject.com/t/ajax-does-not-work-correctly/19105/2 "2023-02-25T15:14:04Z")

</div>

I think the first thing I would do would be to examine closely what is being returned by your ajax calls to ensure that the data you are receiving from the server is what you’re expecting it to be. You can either log that data to your browser’s console or you can examine it in the network tab as the response to that request.

---

<div class="post-metadata">

**Author:** ![Pisych72](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/pisych72/32/12402_2.png) [@Pisych72](https://forum.djangoproject.com/u/Pisych72)\
**Post date:** [February 25, 2023, 3:46pm UTC](https://forum.djangoproject.com/t/ajax-does-not-work-correctly/19105/3 "2023-02-25T15:46:47Z")

</div>

![2](https://us1.discourse-cdn.com/flex026/uploads/djangoproject/original/2X/8/8ee899315e50d4bd9d31e429cd8a360e28d87fff.png)

I’m trying to delete it immediately after adding it without updating the entire page  
PyCharm console:

```auto
Internal Server Error: /SprDelete/
Traceback (most recent call last):
  File "C:\WRH\venv\lib\site-packages\django\db\models\fields\ __init__.py", line 1823, in get_prep_value
    return int(value)
ValueError: invalid literal for int() with base 10: ''

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\WRH\venv\lib\site-packages\django\core\handlers\exception.py", line 47, in inner
    response = get_response(request)
  File "C:\WRH\venv\lib\site-packages\django\core\handlers\base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "c:\WRH\whr\store\views.py", line 196, in SprDelete
    pi=Unit.objects.get(pk=id)
  File "C:\WRH\venv\lib\site-packages\django\db\models\manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "C:\WRH\venv\lib\site-packages\django\db\models\query.py", line 424, in get
    clone = self._chain() if self.query.combinator else self.filter(*args, **kwargs)
  File "C:\WRH\venv\lib\site-packages\django\db\models\query.py", line 941, in filter
    return self._filter_or_exclude(False, args, kwargs)
  File "C:\WRH\venv\lib\site-packages\django\db\models\query.py", line 961, in _filter_or_exclude
    clone._filter_or_exclude_inplace(negate, args, kwargs)
  File "C:\WRH\venv\lib\site-packages\django\db\models\query.py", line 968, in _filter_or_exclude_inplace
    self._query.add_q(Q(*args, **kwargs))
  File "C:\WRH\venv\lib\site-packages\django\db\models\sql\query.py", line 1416, in add_q
    clause, _ = self._add_q(q_object, self.used_aliases)
  File "C:\WRH\venv\lib\site-packages\django\db\models\sql\query.py", line 1435, in _add_q
    child_clause, needed_inner = self.build_filter(
  File "C:\WRH\venv\lib\site-packages\django\db\models\sql\query.py", line 1370, in build_filter
    condition = self.build_lookup(lookups, col, value)
  File "C:\WRH\venv\lib\site-packages\django\db\models\sql\query.py", line 1216, in build_lookup
    lookup = lookup_class(lhs, rhs)
  File "C:\WRH\venv\lib\site-packages\django\db\models\lookups.py", line 25, in __init__
    self.rhs = self.get_prep_lookup()
  File "C:\WRH\venv\lib\site-packages\django\db\models\lookups.py", line 77, in get_prep_lookup
    return self.lhs.output_field.get_prep_value(self.rhs)
  File "C:\WRH\venv\lib\site-packages\django\db\models\fields\ __init__.py", line 1825, in get_prep_value
    raise e. __class__ (
ValueError: Field 'id' expected a number but got ''.
[25/Feb/2023 22:34:56] "POST /SprDelete/ HTTP/1.1" 500 121167

```

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [February 25, 2023, 3:53pm UTC](https://forum.djangoproject.com/t/ajax-does-not-work-correctly/19105/4 "2023-02-25T15:53:17Z")

</div>

So this is the step _after_ where you’re saying the issue is occuring.

You’re calling the url `spr_save`, and what it’s returning is setting up your page to create the problem when `SprDelete` is called.

You need to examine the flow of events in the `spr_save` view. Identify what you’re sending to the server, examine the response, and identify where what you’re getting isn’t properly setting things up.

---

<div class="post-metadata">

**Author:** ![cehceh](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/cehceh/32/3415_2.png) [@cehceh](https://forum.djangoproject.com/u/cehceh)\
**Post date:** [February 25, 2023, 3:56pm UTC](https://forum.djangoproject.com/t/ajax-does-not-work-correctly/19105/5 "2023-02-25T15:56:05Z")

</div>

As I can see in your code (You have a table and if I understand you well) you need to delete a row, Is it true …

> [@Pisych72](#):
>
> But! after adding, deleting does not work

You must to define the current row first then delete it as follow

```auto
 $('table tbody').on('click', '#id_yourBtn', function(){
        
       let currentRow = $(this).closest('tr');
       // Then do what you want with this (currentRow) like
       // let productName = currentRow.find('.product-name').html();
});

```

And an important note here

> [@Pisych72](#):
>
> `ValueError: Field 'id' expected a number but got ''.`

You must fix the Value error first in order to Ajax works  
The error is so clear (YOUR ID RETURNS EMPTY) check it well  
Hope it helps

---

<div class="post-metadata">

**Author:** ![Pisych72](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/pisych72/32/12402_2.png) [@Pisych72](https://forum.djangoproject.com/u/Pisych72)\
**Post date:** [February 25, 2023, 4:02pm UTC](https://forum.djangoproject.com/t/ajax-does-not-work-correctly/19105/6 "2023-02-25T16:02:45Z")

</div>

Yes, I see, id=" ". But why? If add location.reload() in ajax code, ( for save new record) ,it works ok…

---

<div class="post-metadata">

**Author:** ![cehceh](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/cehceh/32/3415_2.png) [@cehceh](https://forum.djangoproject.com/u/cehceh)\
**Post date:** [February 25, 2023, 4:08pm UTC](https://forum.djangoproject.com/t/ajax-does-not-work-correctly/19105/7 "2023-02-25T16:08:32Z")

</div>

> [@Pisych72](#):
>
> ```auto
> File "c:\WRH\whr\store\views.py", line 196, in SprDelete
> pi=Unit.objects.get(pk=id)
> 
> ```

Here is the Error … This indicates that “sid” returns empty

> [@Pisych72](#):
>
> `id=request.POST.get('sid')`

Try to print it to console (in js file via console.log()). To be sure it’s not empty and you will find the missing circle

---

<div class="post-metadata">

**Author:** ![Pisych72](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/pisych72/32/12402_2.png) [@Pisych72](https://forum.djangoproject.com/u/Pisych72)\
**Post date:** [February 25, 2023, 4:34pm UTC](https://forum.djangoproject.com/t/ajax-does-not-work-correctly/19105/8 "2023-02-25T16:34:48Z")

</div>

So, I add new record. id=242, title=‘New Item’.

 ![5](https://us1.discourse-cdn.com/flex026/uploads/djangoproject/original/2X/2/2c3d656798db17f277b4f5999b1223d53e2d0497.png)

---

<div class="post-metadata">

**Author:** ![Pisych72](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/pisych72/32/12402_2.png) [@Pisych72](https://forum.djangoproject.com/u/Pisych72)\
**Post date:** [February 25, 2023, 4:36pm UTC](https://forum.djangoproject.com/t/ajax-does-not-work-correctly/19105/9 "2023-02-25T16:36:57Z")

</div>

Refresh page and delete this record

 ![6](https://us1.discourse-cdn.com/flex026/uploads/djangoproject/original/2X/0/0949f4967fa2ec2918880d5fb70f374bf417b7f2.png)  
Yes, id=242. Thats OK

---

<div class="post-metadata">

**Author:** ![Pisych72](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/pisych72/32/12402_2.png) [@Pisych72](https://forum.djangoproject.com/u/Pisych72)\
**Post date:** [February 25, 2023, 4:37pm UTC](https://forum.djangoproject.com/t/ajax-does-not-work-correctly/19105/10 "2023-02-25T16:37:46Z")

</div>

Add another record

 ![7](https://us1.discourse-cdn.com/flex026/uploads/djangoproject/original/2X/9/94743f6ae9ae44b27bdafec4954f26df26a84341.png)

---

<div class="post-metadata">

**Author:** ![Pisych72](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/pisych72/32/12402_2.png) [@Pisych72](https://forum.djangoproject.com/u/Pisych72)\
**Post date:** [February 25, 2023, 4:39pm UTC](https://forum.djangoproject.com/t/ajax-does-not-work-correctly/19105/11 "2023-02-25T16:39:30Z")

</div>

And try delete it without refresh page. Oops, id=’ '! Why it works with location.reload() only?

 ![8](https://us1.discourse-cdn.com/flex026/uploads/djangoproject/original/2X/b/b2fcba9090ab59ff48c719ae5ec5ecdd3dbce0af.png)

---

<div class="post-metadata">

**Author:** ![cehceh](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/cehceh/32/3415_2.png) [@cehceh](https://forum.djangoproject.com/u/cehceh)\
**Post date:** [February 25, 2023, 4:49pm UTC](https://forum.djangoproject.com/t/ajax-does-not-work-correctly/19105/12 "2023-02-25T16:49:56Z")

</div>

Okay, you need to make another view to get the “id” from ajax and you will use (Ajax method “GET” not “POST”). like

```auto
$.ajax({
                    type: "GET",
                    url: '{% url "AJAX_GET_VIEW" %}',
                    data: {
                        "bank_id": 'YOUR_ID',
                    
                    },
                    success: function (data) { 
                        console.log("Success ");
                    },
                    error: function () {
                        console.log("ERROR with ajax request !!!");
                    }
                });

```

It will work …

---

<div class="post-metadata">

**Author:** ![Pisych72](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/pisych72/32/12402_2.png) [@Pisych72](https://forum.djangoproject.com/u/Pisych72)\
**Post date:** [February 25, 2023, 4:55pm UTC](https://forum.djangoproject.com/t/ajax-does-not-work-correctly/19105/13 "2023-02-25T16:55:12Z")

</div>

Thank you very much. I’ll try to do it tomorrow. It’s night in Siberia now:))

---

<div class="post-metadata">

**Author:** ![Pisych72](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/pisych72/32/12402_2.png) [@Pisych72](https://forum.djangoproject.com/u/Pisych72)\
**Post date:** [February 26, 2023, 3:41am UTC](https://forum.djangoproject.com/t/ajax-does-not-work-correctly/19105/14 "2023-02-26T03:41:00Z")

</div>

I changed the code, but nothing works as it should 😿  
view for delete:

```auto
def SprDelete(request):
    if request.method == 'GET':
        id=request.GET.get('sid')
        print(id)
        pi=Unit.objects.get(pk=id)
        pi.delete()
        return JsonResponse({'status':'Del',})
    else:
        return JsonResponse({'status':0,})

```

AJAX:

```auto
<script>
 output='';

$('#post-form').on('submit',function(e){
event.preventDefault();
var self = this;
let _tlt=$("#idtitle").val();

let csr=$("input[name=csrfmiddlewaretoken]").val();
console.log($(this).attr('action'))
mydata={
title:_tlt,
csrfmiddlewaretoken:csr,
}

$.ajax({
url:$(this).attr('action'),
method:"POST",
data:mydata,
dataType:"json",

success:function(data){

    x=data.unit_data;
    if (data.status=='Save'){
    for(i=0;i<x.length;i++){
    output +='<tr><td class="align-middle" style="width:960px;">'+ x[i].title+'</td>'+
    '<td class="text-center align-middle">'+'<input data-sid="{{item.pk}}" value="Update" type="image" src="../static/images/update.png" style="width:25px;">'+'</td>'
    +
    '<td class="text-center align-middle">'+'<input data-sid="{{item.pk}}" data-del="{{url_delete}}" class="btn-del" value="Delete" type="image" src="../static/images/del.png" style="width:28px;">'+'</td></tr>'
    }

    $('#tbody').html(output)
    output='';
    $("form")[0].reset();
    //location.reload();
    }
    if (data.status == 0){
    alert('Запись не добавлена. Возможно, такая уже есть в справочнике...');
    }
}
});
}
);
///////////////////////////////////////////////////////////////////////////////
/////////////////////////////Delete SPR
$('#tbody').on('click','.btn-del',function(e){
event.preventDefault();
let id=$(this).attr('data-sid');
alert(id);
let pth=$(this).attr('data-del');
console.log(pth);
let csr=$("input[name=csrfmiddlewaretoken]").val();

mydata={sid:id, csrfmiddlewaretoken:csr,};
mythis=$(this);
$.ajax({
url:pth,

method:'GET',
data:mydata,
dataType:"json",

success:function(data){
if(data.status =='Del'){
$(mythis).closest("tr").fadeOut();

}

if(data.status ==0){
console.log('NO');
}
},
});

});

</script>

```

Message in PyCharm:  
ValueError: Field ‘id’ expected a number but got ‘’.  
[26/Feb/2023 10:25:08] “GET /SprDelete/?sid=&csrfmiddlewaretoken=RGmSNrDuBEo7uM82y5GZvrvRh65IMF9mM8bCdcfWXjFjJoWVuJHhB0Qb8ac  
faYhY HTTP/1.1” 500 122454  
Again the same error…Why?  
Could you look at the whole code?  
So, urls.py:

```auto
path('unit/', UnitList, name='UnitList'),
path('spr_Save/',SprSave,name='SprSave'),
path('SprDelete/',SprDelete,name='SprDelete'),

```

views:

```auto
def UnitList(request):
   unit = Unit.objects.all()
   form=UnitForm()
   return render(request,'store/spr/SprList.html',{'title':"Единицы измерения",
   'unit':unit,'form':form,'pic_label':'Единицы измерения','url_name': reverse('SprSave'),
   'url_delete': reverse('SprDelete'),})

# ' ****************************************AJAX************************************'
# сохранение на ajax (Единица измерения):
def SprSave(request):
        if request.method=='POST':
            form=UnitForm(request.POST)

        if form.is_valid():
            title=request.POST['title']
            newrecord=Unit(title=title)
            newrecord.save()
            print(newrecord.id,title)
            un=Unit.objects.values()
            unit_data=list(un)
            return JsonResponse({'status':'Save','unit_data':unit_data})
        else:
            return JsonResponse({'status':0})
# ***********************//AJAX//**********************************************
# удаление единицы измерения
def SprDelete(request):
    if request.method == 'GET':
        id=request.GET.get('sid')
        print(id)
        pi=Unit.objects.get(pk=id)
        pi.delete()
        return JsonResponse({'status':'Del',})
    else:
        return JsonResponse({'status':0,})

```

and template:

```auto
{% extends 'store/menu.html' %}
{% load static %}
{% block DataArea %}

<div class="row">
    <div class="col-md-1 ">{{pic_label}}</div>
<div class="col-md-11 mx-auto shadow">
<table class="table shadow ">
 <thead>

    <tr>
      <th >
<form action={{url_name}} method="post" id="post-form">
        {% csrf_token %}
        {{ form.as_p}}</th>
<th class="pt-4 "> <button type="submit" class="btn btn-primary btn-sm mb-3 pt-2 pb-2 " id="savebtn">Добавить</button>

</form>
</th>
    </tr>
  </thead>
</table>
<div class="scrolltable">
<table class="table shadow table-bordered">
<tbody id="tbody">
    {% for item in unit %}
<tr>
<td style="width:960px; " class="align-middle">{{item.title}}</td>

<td class="text-center align-middle" ><input data-sid="{{item.pk}}" value="Update" type="image" src="{% static '/images/update.png' %}" width="25px" > </td>
<td class="text-center align-middle" ><input data-sid="{{item.pk}}" data-del="{{url_delete}}" class="btn-del " value="Delete" type="image" src="{% static '/images/del.png' %}" width="28px"> </td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
{% endblock DataArea %}

```

All this works only with location.reload() in ajax code 🙄

---

<div class="post-metadata">

**Author:** ![Pisych72](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/pisych72/32/12402_2.png) [@Pisych72](https://forum.djangoproject.com/u/Pisych72)\
**Post date:** [February 26, 2023, 3:58am UTC](https://forum.djangoproject.com/t/ajax-does-not-work-correctly/19105/15 "2023-02-26T03:58:07Z")

</div>

I think the error is somewhere in the add function. I have added the following code in my ajax:

```auto
(function() {
        $('tr').hover(function() {
            $(this).css('background-color', '#FFFF99');
            $(this).contents('td').css({'border': '1px solid grey', 'border-left': 'none', 'border-right': 'none'});
            $(this).contents('td:first').css('border-left', '1px solid grey');
            $(this).contents('td:last').css('border-right', '1px solid grey');
        },
        function() {
            $(this).css('background-color', '#FFFFFF');
            $(this).contents('td').css('border', 'none');
        });
    });

```

And it also doesn’t work after adding a record 😿 Please, help me…

---

<div class="post-metadata">

**Author:** ![Pisych72](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/pisych72/32/12402_2.png) [@Pisych72](https://forum.djangoproject.com/u/Pisych72)\
**Post date:** [February 26, 2023, 5:25am UTC](https://forum.djangoproject.com/t/ajax-does-not-work-correctly/19105/16 "2023-02-26T05:25:58Z")

</div>

Thank you all. I found the solution!This issue has been resolved

```auto
success:function(data){

    x=data.unit_data;
    if (data.status=='Save'){
    for(i=0;i<x.length;i++){
    output +='<tr><td class="align-middle" style="width:960px;">'+ x[i].title+'</td>'+
    '<td class="text-center align-middle">'+'<input data-sid="{{item.pk}}" value="Update" type="image" src="../static/images/update.png" style="width:25px;">'+'</td>'
    +
    '<td class="text-center align-middle">'+'<input data-sid='+x[i].id+' data-del="{{url_delete}}" class="btn-del" value="Delete" type="image" src="../static/images/del.png" style="width:28px;">'+'</td></tr>'
    }

```

_x[i].id_
