jsonp
参考资料JSONP 跨域原理及实现 - JavaScript进阶之路 - SegmentFault 思否
定义解决跨域的一种方法
jsonp本质上是使用了浏览器不会限制script标签source属性的访问,故可以让服务器将响应封装到js代码里返回
例子12345678910111213141516171819202122@WebServlet("/jsonp")public class JsonpServlet extends HttpServlet { private static final long serialVersionUID = 1L; protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // 设置响应类型为JavaScript response.setContentType(" ...