I want to send data from python to JS in Django. I successfully see the data in the response in the browser, but JS returns as empty string. What would be the reason?
trying to fetch information;
def XXX(request):
message_id=request.POST.get('messageid')
return render(request, 'XX.html')
sender;
y = json.loads(response.text)
ts = str(y["file"]["shares"]["public"]["XX"][0]["ts"])
return render (request, 'problemduyurusucreate.html', {'ts':ts})
JS;
...
var test = "{{ ts }}";
$.ajax({
type: "POST",
url: "{% url 'slack' %}",
data: {
"messageid": test,
csrfmiddlewaretoken: '{{ csrf_token }}'
}
...
but I am displaying in my browser that I have successfully pulled the data