Ajax调用restful接口传送Json格式数据的方法 ajax传送json格式数据,关键是指定contentType,data要是json格式 如果是restful接口,把type改成对应的post(增)、delete(删)、put(改)、get(查)即可 var post_data={"name":"test001","pass":"xxxx"}; $.ajax({ url: "http://192.168.10.111:8080/uc/login", type: 'post', contentType: "application/json; charset=utf-8", data:JSON.stringify(post_data), success:function (data) { //调用成功 }, error: function(data, textStatus, errorThrown){ //调用失败 } }); 以上所述是小编给大家介绍的Ajax调用restful接口传送Json格式数据的方法的全部叙述,希望对大家有所帮助,如果大家想了解更多内容敬请关注中文源码网网站!