标签:page text todo var code cti amp success tput
前端代码
<script src="http://apps.bdimg.com/libs/jquery/1.9.1/jquery.min.js"></script> <script type="text/javascript"> var time = ‘2017-03-01‘; var money = 300.15; var remark = ‘aaa‘; $.ajax({ url: ‘http://localhost:8084/TeamAccount/AddOne‘, type: ‘get‘, dataType: ‘jsonp‘, data: { time: time, money: money, remark: remark }, success: function (data) { console.log(data); } }); </script>
后台返回
try (PrintWriter out = response.getWriter()) { String callback = request.getParameter("callback"); String retStr = callback + "({\"name\":\"beidao\",\"age\":25});"; /* TODO output your page here. You may use following sample code. */ out.println("retStr"); }
注意: retStr的格式“callback+(json串);
标签:page text todo var code cti amp success tput
原文地址:http://www.cnblogs.com/heirenly/p/6360457.html