<script src="http://libs.baidu.com/jquery/1.6.1/jquery.min.js"></script>
<div id="showMsg"></div>
<script type="text/javascript">
$.getJSON("http://www.xxx.cc/xxxGateway/link/returnJsonp.shtml?from=100yue&locate=02&jsoncallback=?",function(data){
$("#showMsg").html(data[0].val);
});
</script>
@RequestMapping("/returnJsonp")
public void
returnJsonp(HttpServletRequest request, HttpServletResponse response) throws
IOException {
// 来源网站
String from
= request.getParameter("from");
// 来源位置
String
locate = request.getParameter("locate");
String jsoncallback =
request.getParameter("jsoncallback");
response.setContentType("text/html");
response.setCharacterEncoding("utf-8");
PrintWriter
out = response.getWriter();
//获取链接文字
String
returnval =
Constants.RB.getString("text_XXX");
out.print(jsoncallback+"([{val:‘"+returnval+"‘}])");
}
原文:http://www.cnblogs.com/yangy608/p/3611582.html