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.