function saveCommentTemplate()
{
    $.ajax({
        cache : false,
        type:'get',
        dataType:'json',
            url:'comment/insert',
            contentType:'application/json;charset=UTF-8',  
            data:{name:encodeURI($("#name").val()),
                content:encodeURI($("#content").val())},
        success:function(data){
            alert("ok") 
        },
        error: function() {  
            alert("error")  
        }  
    });
    $("#bottom").hide();
}

 

后台代码,在对数据进行解码:

@RequestMapping(value = "insert")
    @ResponseBody
    public void insert(@RequestParam("name") String name,@RequestParam("content")String content) throws UnsupportedEncodingException
    {
        name=URLDecoder.decode(name,"UTF-8");
        content=URLDecoder.decode(content,"UTF-8");
        commentTemplateService.saveCommentTemplate(name,content);
    }

 

相关文章:

  • 2021-09-15
  • 2021-11-30
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-14
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-05
  • 2021-12-14
  • 2021-10-15
  • 2021-11-03
  • 2021-09-09
  • 2021-10-22
相关资源
相似解决方案