Ajax 关于contentType和dataType

ContentType: When sending data to the server, use this content type. Default is application/x-www-form-urlencoded; charset=UTF-8, which is fine for most cases.
发送到服务器的数据格式,一般默认为“application/x-www-form-urlencoded; charset=UTF-8”
DataType: The type of data that you’re expecting back from the server. If none is specified, jQuery will try to infer it based on the MIME type of the response. Can be text, xml, html, script, json, jsonp.
服务器返回的数据类型,如果没有定义,则会根据情况返回对应的类型。
https://stackoverflow.com/questions/14322984/differences-between-contenttype-and-datatype-in-jquery-ajax-function

猜你喜欢

转载自blog.csdn.net/Bambi12/article/details/83000898
今日推荐