Need to send an Ajax request to a Solr server that’s on a different domain? You will, of course, need to use JSONP instead of an ordinary JSON request, due to JavaScript’s cross-domain security restrictions. To get a properly padded response from Solr, add the json.wrf
parameter to your query string, giving it the name of your callback function. In jQuery:
jQuery.ajax({ url: mySolrUrl, data: myQueryParameters, success: mySuccessCallback, dataType: 'jsonp', jsonp: 'json.wrf' });
Of course, for this to work the Solr server you’re accessing needs to be publicly accessible, which probably isn’t ideal for security.