ajsie
ajsie

Reputation: 79836

solr wont work with jquery

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?

Upvotes: 1

Views: 1863

Answers (1)

Mauricio Scheffer
Mauricio Scheffer

Reputation: 99750

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

Also take a look at the ajax-solr project.

Upvotes: 1

Related Questions