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){}
})
相关推荐
爱笑鱼1 天前
Binder(八):远端进程死了,BinderProxy 为什么还能收到通知?
android
Android-Flutter1 天前
Kotlin 冷流与热流详解
android·kotlin
zhangphil1 天前
Android ContentProvider/ContentResolver读图片,跨进程 IPC慢
android
yueqc11 天前
Android .so 文件压缩
android·so·包体积
龚礼鹏1 天前
深入解析 Android Automotive (AAOS) 启动流程与 CarService 核心机制(基于 Android 16 最新源码视角)
android
rosmis1 天前
agent各指标定义
android·java·开发语言
风样滴男人哟1 天前
PHP特性之反射类ReflectionClass机制
android·开发语言·php
小孔龙1 天前
RenderNode 与 DisplayList:Android 硬件加速的绘制记录与复用
android·性能优化
qizayaoshuap1 天前
鸿蒙 ArkTS 实战:搜索列表 城市实时过滤(示例 94)
android·华为·harmonyos
朝星1 天前
Framework筑基之Handler消息机制5(应用层)
android