Обновление контекстной переменной с помощью ajax

получаю null вместо обновленного значения при срабатывании события в шаблоне, получаю правильное значение в терминале и консоли, например success 6 и 6 соответственно. Как мне заставить реальное значение выводиться вместо null, не стесняйтесь улучшить этот вопрос, если вы видите что-то не так. Здоровья!

Вот мой код:

path('ajax_update/', views.ajax_update, name="ajax_update"),

view

def ajax_update(request):
    stuff = bagstuff(request)
    bag = stuff['bag']

    if is_ajax and request.method == "GET":
        if bag:
            print("success", bag)
            data_attribute = request.GET.get(bag)
        return JsonResponse(data_attribute, safe=False, status=200)
    else:
        print("failed")

    context = {"bag": bag}
    return render(request, template, context)

template:

<script>
    var number= "{{bag}}";
    var update_bag_url = "{% url 'main:ajax_update' %}";
</script>

javascript:

function update_bag() {
    // optional: don't cache ajax to force the content to be fresh
    $.ajaxSetup ({
        cache: false
    });
    // specify loading spinner
    var spinner = "<img alt='loading..' />";

    $("#lil-icon-two").html(spinner).load(update_bag_url);
    console.log(number);
}
Вернуться на верх