Springboot Project Ajax post appears bad Request error background debugging non-breakpoint solution __springboot

Source: Internet
Author: User

When using Ajax, you may encounter inexplicable errors, and you need to learn to use the developer tools to view and locate and solve problems. Related to this issue, you can also refer to: POST Bad request the request sent by the client is syntactically incorrect


Recently, a small partner asked:

When using AJAX, the path to the request is right, but it is not always possible to enter this method, what is the reason, have you ever encountered such a problem.

And no mistakes were reported.

I:

To see what's wrong, open the browser's developer tool

He:

Oh, yes, I see it.


The mistake has been fixed, do you know how to solve it?

Perhaps a lot of small partners are still a face to be forced.

Look backstage:


Notice the entity class in the argument to see if it has a special field.

Most of the cases are caused by special fields.


Another way to submit an AJAX form:

Sometimes it is possible to submit a parameter without coding the problem, then you can submit a different way, the following way of submission is very powerful, file upload can also be submitted. If you use the normal method to construct the JSON format parameter is not OK OH.


<form action= "#" id= "Ajaxsubmit" >

By changing this way, you will find that the error has become 500, and it is clear that you can see that the service is out of error and look at the console output.


Then you have to think about the JSON to the object when the problem, the entity classes have any special type.

He:

Time, the page is a string passed over, the following type is data, add this to solve:


Well, the problem has been solved, have you solved it.

Don't leave a message, tell me your specific situation.

It's settled, what have you learned? Also message support.


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.