How to response ajax request in Django

前端 未结 6 664
悲哀的现实
悲哀的现实 2020-12-09 12:48

I have code like this:

$(document).ready(function(){
    $(\'#error\').hide();
    $(\'#submit\').click(function(){
        var name = $(\"#name\").val();
           


        
6条回答
  •  星月不相逢
    2020-12-09 13:42

    if nothing works, put "@csrf_exempt" before your function

    from django.views.decorators.csrf import csrf_exempt
    
    @csrf_exempt
    def lat_ajax(request):
    """
    your code
    """
    

提交回复
热议问题