cf2000 发表于 2015-7-19 08:07:14

jquery 请求apache solr 跨域解决方案

var url = "http://172.21.0.31:13131/solr/xml/select?q=*%3A*&wt=json&indent=true";
$(function(){
//1.getJSON 方式
$.getJSON(url+"&json.wrf=?", function(data){
console.log(JSON.stringify(data));
});
//2.ajax 方式
      $.ajax({
'url': url,
//'data': {'wt':'json', 'q':'your search goes here'},
'success': function(data) {
console.log(JSON.stringify(data));
},
error : function() {
alert('1');
},
'dataType': 'jsonp',
'jsonp': 'json.wrf'
});
});

  
页: [1]
查看完整版本: jquery 请求apache solr 跨域解决方案