javascript - How to debug when submitting a form?
我想大声告诉你
我想大声告诉你 2017-06-12 09:21:40
0
3
1421

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?

我想大声告诉你
我想大声告诉你

reply all(3)
黄舟

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

巴扎黑

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

学习ing

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();                //阻止表单提交
});
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template