前端get请求:
function() {
     var href = "/platform_wechat/MedicalHome/update.do?>地址以及传递的参数
     $.get(href, function(res) {  //res为接口返回数据
           if (res.success) {  
                 //请求成功处理业务
            }else{
                  //请求失败处理业务
           }
     }     

}

后端接口:

@Controller
@RequestMapping("/platform_wechat/MedicalHome")
public class MedicalHomeAction {
    @RequestMapping(value = "update.do", method =RequestMethod.GET)
    @ResponseBody
    public Map<String,Object> update(String id){
        Map<String,Object> map = new HashMap<String, Object>();
     int result= appletConfigDao.update(id);
        if(result>0){
            map.put("success", true);
            map.put("info", "成功提示");
        }else{
            map.put("success", false);
            map.put("info", "失败提示");
        }
        return map;
    }

    //如果是查询数据直接返回一个实体类对象


}


post请求:
   function() {
    var href = "/platform_wechat/MedicalHome/update.do?>地址以及传递的参数
    var params = {"id":""+id+"","authResult":"1","refuseText":"",};   //请求参数,写成键值对类型,键对应实体类的name,后端用实体类接受   
     $.post(href, params ,function(res) {  //res为接口返回数据
           if (res.success) {  
                 //请求成功处理业务
            }else{
                  //请求失败处理业务
           }
     }     

}


后端接口一样:
    method = POST   接收参数用实体类对象

 

相关文章:

  • 2021-05-20
  • 2021-08-30
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-02-27
  • 2022-12-23
  • 2021-08-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案