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?
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
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(); //阻止表单提交
});
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 OKMost browsers support developer tools. Under [Network], you can find the header information of the corresponding file (form processing page):
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: