未捕获的范围错误:构建参数时超出最大调用堆栈大小

我找不到哪里有错误。请帮忙


当我提交表单时,我在控制台中收到以下错误


 Uncaught RangeError: Maximum call stack size exceeded     at buildParams

我看到了不同的答案,但他们没有帮助我找到错误


杰奎里


<script type="text/javascript">

    var frm = $('#message-form');

    frm.on('submit',function(e){

            e.preventDefault();

            $.ajax({

                type: frm.attr("method"),

                url: "message/message_form/",

                dataType: 'json', 

                data: { csrfmiddlewaretoken: "{{ csrf_token }}", frm:frm},

            })

            .done(function(response){

             console.log(response.message)

            });

        });

</script>

断续器


<div class="fixed-bottom">

    <form id="message-form"  user_id="{{u.id}}" method="POST">

        <input type="hidden" id="user_id" name="user_id" value="{{u.id}}">

        {% csrf_token %}

        <div class="container">

            <div class="row">

                <div id="text" class="col-10">

                    {{ msgform.text }}

                </div>


                <div class="col-1">

                    <button id="submit" class="btn"  type="submit"><img height="30px" src="/static/img/send-button.png" alt="send"></button>

                </div>

            </div>

        </div><br>

    </form>  

</div>

感恩节在高级


富国沪深
浏览 67回答 1
1回答

慕标5832272

发送数据时出现问题。当我用来发布数据并接受视图时,一切正常JSON.stringifyjson.loads(request.POST.get('frm'))$('#messageform').on('submit', function(e) {&nbsp; e.preventDefault();&nbsp; var frm = {&nbsp; &nbsp; 'user_id': $('#user_id').attr('value'),&nbsp; &nbsp; 'text': $('#form_message').val()&nbsp; };&nbsp; frm = JSON.stringify(frm);&nbsp;&nbsp;&nbsp; $.ajax({&nbsp; &nbsp; type: 'POST',&nbsp; &nbsp; url: "message/message_form/",&nbsp; &nbsp; dataType: 'json',&nbsp; &nbsp; data: {&nbsp; &nbsp; &nbsp; csrfmiddlewaretoken: "{{ csrf_token }}",&nbsp; &nbsp; &nbsp; 'frm': frm&nbsp; &nbsp; },&nbsp; })});views.pydef post(self, request):&nbsp; &nbsp; &nbsp; &nbsp; dictionary = json.loads(request.POST.get('frm'))&nbsp; &nbsp; &nbsp; &nbsp; print('=================',dictionary)&nbsp; &nbsp; &nbsp; &nbsp; u = get_object_or_404(User,pk=dictionary['user_id'])&nbsp; &nbsp; &nbsp; &nbsp; msg = message.objects.filter(sender=request.user).filter(receiver=u).all() | message.objects.filter(sender=u).filter(receiver=request.user).all()&nbsp; &nbsp; &nbsp; &nbsp; u = message.objects.create(sender=request.user,receiver=u,text=dictionary['text'])&nbsp; &nbsp; &nbsp; &nbsp; #if request.user != u and u.objects.filter(receiver__sender=request.user,receiver__receiver=u,receiver__read=False).exists :&nbsp; &nbsp; &nbsp; &nbsp; #&nbsp; &nbsp; notify.send(request.user, recipient=u, verb="message you please read in message box",public=False)&nbsp; &nbsp; &nbsp; &nbsp; # msg = message.objects.filter(sender=request.user).filter(receiver=u).all() | message.objects.filter(sender=u).filter(receiver=request.user).all()&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; msg = dictionary['text']&nbsp; &nbsp; &nbsp; &nbsp; data = { "message":msg}&nbsp; &nbsp; &nbsp; &nbsp; return HttpResponse(json.dumps(data), content_type='application/json')
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript