skip to Main Content

How pass the variable from template to view? – Jquery ajax

template.html <input type="text" id="text"> <input id="submit" name="submit" type="submit"> <div id="roro"></div> <script type="text/javascript"> $('#submit').click(function(){ $.ajax({ url:'', data : {'text':$('#submit').val()}, type: 'POST', dataType : 'json', success:function(data){ $('#roro').text(result['data']); }, error:function(r){ alert(text); } }); }); </script> view.py @csrf_exempt def construction(request): if request.method == 'POST':…

VIEW QUESTION

Django HttpResponse "expected a bytes-like object, str found" – CentOS

I'm getting the above TypeError from a healthcheck route on Django 3.1.2 on python 3.6. The full error logged is: ERROR 2020-11-02 18:32:32,046 /home/centos/venv/lib/python3.6/site-packages/django/utils/log.py log_response Internal Server Error: /healthcheck/ Traceback (most recent call last): File "/home/centos/venv/lib/python3.6/site-packages/django/core/handlers/exception.py", line 47, in inner…

VIEW QUESTION
Back To Top
Search