我在這方面很新穎。 我需要找出如何使用Ajax向我的solr服務器發出請求 如何在請求中提供url(我的solr服務器的url) 任何機構都知道如何處理這個問題? 我怎麼能做出下面提到的URL的請求如何使用AJAX請求網址
http://mysite:8080/solr/select/?q=%2A%3A%2A&version=2.2&start=0&rows=100&indent=on
在這裏看到:更正代碼片段如下
function getProductIds() {
var xmlhttp;
if (window.XMLHttpRequest) xmlhttp = new XMLHttpRequest();
else xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) console.dir(xmlhttp);
else alert('no response');
var ajaxURL = "http://localhost:8080/solr/select/?q=*:*&version=2.2&start=0&rows=100&indent=on";
xmlhttp.open("GET", ajaxURL, true);
xmlhttp.send();
}
這是我的代碼,它總是顯示「無響應」
謝謝。
感謝Deeptechtons – 2011-05-19 11:08:14
@Nikhil所以它的工作。我沒有休息,直到它的工作:D順便說一句,如果它回答了請點擊投票控件下方的刻度標記 – Deeptechtons 2011-05-19 11:29:47
雅它工作,但我沒有得到任何迴應從服務器。我使用的代碼可以在上面找到。 當我在瀏覽器中使用url時,我得到了工作,我在我的瀏覽器中得到了xml響應 但在Ajax中使用它時我沒有收到任何回覆 請幫助我 – 2011-05-19 11:52:39