This is my javascript code ,from where I am calling solr ,which has a
loaded nutch core (index).
My java script client ( runs on TOMCAT server) and Solr
server are on the same machine (10.21.6.100) . May be due to cross
domain references issues OR something is missing I don't know.
I expected Response from Solr server (search result) as raw JASON
object. Kindly help me fix it.Thanks in advance .

Rgds
Sunil Kumar


<html>
<head>  <title>Solr Search </title> </head>
<body>
    <script language="Javascript">
    function search()
    {
     var xmlHttpReq =false;
     var  xmlHttpClient=this;

     var hostURL='http://10.21.6.100:8983/solr/nutch/select';
     var querystring=document.getElementById("querystring").value;
     qstr='q='+escape(querystring)+"&fl=content";

     if(window.XMLHttpRequest){  xmlHttpClient.xmlHttpReq=new
XMLHttpRequest(); }

     xmlHttpClient.xmlHttpReq.open('POST',hostURL,true);


xmlHttpClient.xmlHttpReq.setRequestHeader('Content-Type','application/x-www-form-urlencoded');

     xmlHttpClient.xmlHttpReq.send(qstr);

     xmlHttpClient.xmlHttpReq.onreadystatechange=function()
      {
      if(xmlHttpClient.xmlHttpReq.readyState ==4 )
            { showresponse(xmlHttpClient.xmlHttpReq.responseText);}
      }

    }

     function showResponse(str)
    {
       document.getElementById("responsestring").innerHTML=str;
    }

    </script>

     <h3>Solr Search [ From Javascript ]</h3>
    <div align='center'>
     <input id="querystring" name="querystring" type="text"
placeholder="Search here..">
     <input value="search" type="button" onClick='search();'>
     <p>
       <div id="result"> </div>
       <div id="responsestring"> </div>
     </div>
</body>

Reply via email to