How do you update a django template context variable after an AJAX call?
<p>I have a table Product that shows information of a group of products.</p>

<pre><code>    &lt;table id="item_table" class="table table-sm table-hover table-bordered"&gt;
        &lt;thead class="thead-inverse"&gt;
        &lt;tr&gt;
            &lt;th colspan="2"&gt;Date&lt;/th&gt;
            &lt;th colspan="6"&gt;Product name&lt;/th&gt;
            &lt;th colspan="2"&gt;Category&lt;/th&gt;
            &lt;th colspan="2"&gt;Amount&lt;/th&gt;
        &lt;/tr&gt;
        &lt;/thead&gt;
        &lt;tbody&gt;
            {% for item in product_list %}
            &lt;tr&gt;
                &lt;td colspan="2"&gt;{{ item.date }}&lt;/td&gt;
                &lt;td id="item_name_format" colspan="6"&gt;{{ item.name }}&lt;/td&gt;
                {% if item.category_id %}
                &lt;td id="item_name_format" colspan="2"&gt;{{ item.category_id.level1_desc }}&lt;/td&gt;
                {% endif %}
                &lt;td id="item_amt_format" colspan="2"&gt;${{ item.amount|intcomma }}&lt;/td&gt;
            &lt;/tr&gt;
            {% endfor %}
        &lt;/tbody&gt;
    &lt;/table&gt;
</code></pre>

<p>I am using the below Ajax call you update the table.</p>

<pre><code>$(document).ready(function(){

// Submit post on submit
$('.item_num').on('click', function(event){
    event.preventDefault();
    var item_num = $(this).attr('id');
    update_item(item_num);
});

function update_item(item_num) {
    console.log(item_num) // sanity check
    $.ajax({
        type: 'GET',
        url:'update_items', 
        data: { 'item_num': item_num },

        success: function(result){
            console.log(result);
            ???$('item_table').product_list = result;???
        },
... more code
</code></pre>

<p>How do I update the variable product_list with 'result' from my Ajax call?</p>

<p>This should update the table right?</p>

<p>Thanks</p>