Home  >  Q&A  >  body text

javascript - How to debug when submitting a form?

Note: I am not talking about ajax simulated form submission, I am talking about direct submission of the original form.
When submitting a form, how do you debug the front-end to see if the values ​​in the form are passed?

我想大声告诉你我想大声告诉你2687 days ago1402

reply all(3)I'll reply

  • 黄舟

    黄舟2017-06-12 09:23:40

    To see the submitted request, you must look at Network. You must have jumped to the browser after submission and cannot find the request submitted by your form under the request. You can check Network -> Preserve log, and your form will be submitted. The request is recorded. Then look at the requested data and it’s OK

    reply
    0
  • 巴扎黑

    巴扎黑2017-06-12 09:23:40

    Most browsers support developer tools. Under [Network], you can find the header information of the corresponding file (form processing page):

    reply
    0
  • 学习ing

    学习ing2017-06-12 09:23:40

    Form submission usually results in a page jump. After the form is submitted, open the Network in the F12 debugging tool on the jumped page and find the page request to view it. If you don’t want to do this, you can bind the onsubmit method to the form on the page and view it in the method. The code is as follows:

    $('form').submit(function(e){
        var data = $(this).serialize();    //序列化表单
        console.log(data);                 //打印表单数据
        e = e || window.event;
        e.preventDefault();                //阻止表单提交
    });

    reply
    0
  • Cancelreply