这是一个标准的ajax请求:

 1 $.ajax({
 2              type:"post",
 3              url:basePath+"/resourcePush/operationLog",
 4              async:false,
 5              data: JSON.stringify(json),
 6             contentType : "application/json;charsetset=UTF-8",
 7             dataType:"json",
 8              success: function(data){
 9                 
10              },
11              error:function () {
12                  
13              }
14          });

 

其中dataType是描述springMVCf返回的参数;

 

contentType是描述传递的参数,

如果默认不写的话,则SpringMVC对应注解是requestParam

如果是其它指定的,比如

contentType : 'application/json;charset=UTF-8',

contentType : 'text/html;charset=UTF-8',

则SpringMVC对应注解是requestBody

 

async:false,是同步

async:true,是异步

相关文章:

  • 2021-11-29
  • 2021-12-15
  • 2021-10-27
  • 2022-01-07
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-10-10
  • 2022-12-23
  • 2021-06-09
  • 2021-05-27
  • 2021-08-06
相关资源
相似解决方案