jsnop

<script src="http://libs.baidu.com/jquery/1.6.1/jquery.min.js"></script>javascript

<div id="showMsg"></div>html

<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>java

 

 

 

 

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

相關文章
相關標籤/搜索