DataType vs ContentType in jquery ajax [duplicate] 数据类型
2016-06-16 11:26
507 查看
一个是向服务器上上传的格式,一个是从服务器上下载过来的数据格式 (ps:正好理解反了,) 注:这句话是错误的
You can use the
Response object to send output to the client.
What is the purpose of both in client side request and Server side response ?
dataType: the type of data that you're expecting back from the server.
The
ContentType property specifies the HTTP content type for the response. If no
ContentType is specified, the default is text/HTML.
Syntax
Response.ContentType [=ContentType]
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.If you exlicitly pass in a content-type to $.ajax(),then it is always sent to the server(even if no data is sent). the W3C XMLHttpRequest specification
dictates that the charset is always UTF-8; specifying another charset will not force the browser to change the encoding.
You can use the
Response object to send output to the client.
What is the purpose of both in client side request and Server side response ?
dataType: the type of data that you're expecting back from the server.
The
ContentType property specifies the HTTP content type for the response. If no
ContentType is specified, the default is text/HTML.
Syntax
Response.ContentType [=ContentType]
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.If you exlicitly pass in a content-type to $.ajax(),then it is always sent to the server(even if no data is sent). the W3C XMLHttpRequest specification
dictates that the charset is always UTF-8; specifying another charset will not force the browser to change the encoding.
相关文章推荐
- jquery 插件写法
- jquery datatable插件使用分享
- HighCharts入门
- jQuery插件实现文件上传功能(支持拖拽)
- jQuery插件实现图片轮播特效
- Jquery 页面元素动态添加后绑定事件丢失方法,非 live
- jquerymobile和Phonegap 搭建跨平台开发环境
- jQuery获取剪贴板内容的方法
- jquery延迟加载插件
- JQ拖曳效果
- jQuery如何设置复选按钮选中,求解
- Python实现类似jQuery使用中的链式调用的示例
- jquery easyui datagrid 的选中、选择
- Jquery里live事件移除原因
- Jquery源码解析-设计理念
- jQuery插件开发全解析
- 实现jQuery扩展总结
- jQuery扩展插件和拓展函数的写法
- jQuery插件之路(三)——文件上传(支持拖拽上传)
- Jquery中$.get(),$.post(),$.ajax(),$.getJSON()的用法总结