<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!-- 解决IE情况下不识别JSON对象的情况 -->
<meta http-equiv="X-UA-Compatible" content="IE=edge;chrome=1" />
<title>Insert title here</title>
<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
<script type="text/javascript">
//var url = "http://172.21.0.31:13131/solr/xml/select?q=*%3A*&wt=json&indent=true";
//url = "http://172.21.0.31:13131/solr/gxdemo/mlt?mlt.interestingTerms=details&stream.body=世纪公园";
url = "http://localhost:8080/solr/test4/select?q=%E7%99%BE%E5%BA%A6&wt=json&indent=true";
$(function() {
//1.getJSON 方式
/*
* 可以设置一些ajax的参数
*/
$.ajaxSetup({
cache : false,
contentType : "application/json; charset=utf-8"
}); $.getJSON(url + "&json.wrf=?", function(data) {
//console.log(JSON.stringify(data));
$('#test').html(JSON.stringify(data));
//alert(JSON.stringify(data));
}); /*
//2.ajax 方式
$.ajax({
'url': url,
contentType: "application/json; charset=utf-8",
cache:false,
//'data': {'wt':'json', 'q':'your search goes here'},
'success': function(data) {
//console.log(JSON.stringify(data));
alert(JSON.stringify(data));
},
error : function() {
alert('1');
},
'dataType': 'jsonp',
'jsonp': 'json.wrf'
});
*/
});
</script>
</head>
<body>
<div id="test"></div>
</body>
</html>

最新文章

  1. 10款html5开发工具,实用+好用
  2. c# 根据文件流查看文件真实格式
  3. android fragment 的用法以及与activity的交互和保存数据的方法,包括屏幕切换(转载)!
  4. Android蓝牙实例(和单片机蓝牙模块通信)
  5. BZOJ1933: [Shoi2007]Bookcase 书柜的尺寸
  6. Show &quot;Appear Offline&quot; in Lync
  7. 2.16 最长递增子序列 LIS
  8. cnblogs体验
  9. 给View换字体
  10. PHP5的对象复制
  11. BZOJ 2809: [Apio2012]dispatching( 平衡树 + 启发式合并 )
  12. 初探linux子系统集之timer子系统(三)
  13. vue2.0-基于elementui换肤[自定义主题]
  14. 【codeforces 983E】NN country
  15. 免费SSL证书(支持1.0、1.1、1.2)
  16. 休眠(1):sleep和wait的区别
  17. C++中的stack类、QT中的QStack类
  18. [转]Javascript实现图片的预加载详解
  19. cocos2d-x入门学习笔记,主要介绍cocos2d-x的基本结构,并且介绍引擎自带的示例
  20. Exception异常转String【转】

热门文章

  1. Instagram的技术探索2(转)
  2. java线性表学习笔记(二)
  3. Ubuntu下Android编译环境的配置
  4. MBR所在位置
  5. UVaLive 6809 Spokes Wheel (模拟)
  6. PB学习笔记(一)
  7. Centos下忘记mysql的root密码的解决方法
  8. Linux 网络编程 高级套接字
  9. PPAS上运行pg_dump经过II
  10. WOSA/XFS及SP综述