DataType and server setContentType in ajax

Are the dataType and server setContentType, in

ajax repeated? why does the server sometimes report an error when text/plain,dataType is set to "json"?

I read the Internet and said:

1. Server does not return response content-type:application/json, frontend dataType specifies json, to decode http response content. Data type is Object

2. Server returns response content-type:application/json, frontend dataType does not specify json, to decode http response content, data type is Object

, first ask what decoding http means, isn"t json a data type, and decoding is something like iso-8859-1 fufmi 8 and so on? how can it be linked together? Then why can both of them be decoded and returned to Object,? is it possible that dataType and the server can just set one, and the two functions are the same?

Mar.22,2021
Menu