Why is there an equal sign at the end of the json received by Java?

recently use jquery"s ajax to send Json data to the Java background, because the default requested ContentType is application/x-www-form-urlencoded;charset=UTF-8, resulting in an extra "=" at the end of the Json data received by the background.
now that I know that changing ContentType to application/json;charset=utf-8 can solve this problem, I"d like to ask why there is an extra = by default. Do you want to take a look at the source code? I don"t know how to look at it yet.


application/x-www-form-urlencoded;charset=UTF-8 is a key-value pair structure, that is, something like this:

name=tim&age=20
In fact, the extra equal sign of

is because the content is regarded as key, while the value is empty
, and it is right to transfer data with the correct content-type, which is more friendly to the framework

.
  • Ajax cannot get the value of controller

    problem description background written by others, I didn t write the interface before I wrote the interface myself and then called it with ajax to get no data. I don t know what went wrong. I don t know exactly where to put the js and html files ...

Menu