jquery中ajax总结

在ajax请求接口的时候,常用到以下参数,在这里记录下

contentType用于告诉服务器请求的数据类型,常见的有

text/html:HTML网页

text/plain:纯文本

application/json:JSON格式

application/xml:XML格式

image/gif:GIF图片

image/jpeg:JPEG图片

audio/mpeg:音频MP3

video/mpeg:视频MPEG

Content-Type描述了消息体语言字符编码和内容格式,每个Content-Type都包含了多个参数,他们用";"分割

javascript 复制代码
let params={
        ticket:'12312313',
        moveLength:'45',
        phone:'13821569856',
 };
$.ajax({
        url:'/member/register/checkCodeImg',
        data:JSON.stringify(params),//将json对象转成字符串传输
        type:'post',
        dataType:'json',
        contentType: 'application/json;charset=UTF-8',
        async:false,//是否异步
        success:function(data){},
        error:function(data){}
})
相关推荐
亘元有量-流量变现7 小时前
2026安卓ASO增量攻略:摆脱iOS思维依赖,吃透多商店自然免费流量
android·aso优化·亘元有量·方糖试玩
一航jason7 小时前
安卓车机端 AIOS 技术生态全景
android·人工智能·ai·ai编程·ai-native
深念Y7 小时前
ZTE B860AV1.1-T2 机顶盒改造记录:从 Android 到 Linux 服务器
android·linux·运维·服务器·boot·cma·机顶盒
淡淡的香烟8 小时前
Android中tcp的通信
android·物联网·tcp/ip
Escalating_xu9 小时前
【C++入门基础(下)】默认参数、函数重载、引用、inline 与 nullptr
android·c++·redis
wen_zhufeng20 小时前
用 vLLM 加速 TTS 推理:通用改造指南
android·vllm
长友cy1 天前
windows 搭建Qt编译Android 应用程序,快速搭建
android·windows
智驭未来掌门人1 天前
Android Kotlin 开发避坑指南:从语言特性到工程化实践
android
码农coding1 天前
android12 ViewRootImpl分析
android
stevenzqzq1 天前
compose项目返回到当前页面闪烁原因分析
android