开发者

solr wont work with jquery

开发者 https://www.devze.com 2022-12-14 10:44 出处:网络
开发者_StackOverflow中文版When I enter \'http://localhost:8983/solr/select/?q=body:hello` in the URL field I get all the correct results.

开发者_StackOverflow中文版When I enter 'http://localhost:8983/solr/select/?q=body:hello` in the URL field I get all the correct results.

but when I'm using jquery code:

$.post(http://localhost:8983/solr/select/?q=body:hello, function(data){
       alert(data);
});

OR

$.post('http://localhost:8983/solr/select/?, {q: 'body:hello'}, function(data){
       alert(data);
});

I get nothing. it doesn't give me anything. not even an alert.

I have tried $.get as well without result.

what could the problem be and what is best practice for using solr with ajax?


You should use $.getJSON and the JSON response writer (wt=json in your querystring).

Also take a look at the ajax-solr project.

0

精彩评论

暂无评论...
验证码 换一张
取 消