1👍
✅
Try something like
var $csrf = $('<input/>')
.attr("type", "hidden")
.attr("name", "csrfmiddlewaretoken")
.attr("value", "{{csrf_token}}");
$($csrf).appendTo($div);
👤NS0
Source:stackexchange.com