jsnop

<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+"'}])");
 }

posted @ 2014-03-19 15:43  七郎  Views(440)  Comments(0Edit  收藏  举报