XML : Html/Javascript - how to get JSON/XML content from window/document (Solr)?

I got a little problem. I want to open a new window in JavaScript. All fine. I save the new window in a variable:

  var testWindow = window.open(url, "_blank");    

the url param is a url to a Solr server core - I open a search query in a new window. The response format can be json or xml - no matter what. All I want now is: Get the response results and save them to a JavaScript array so that I can work with them. The Problem is: the result, for example, in JSON looks like:

    {    "responseHeader":{      "status":0,      "QTime":0,      "params":{        "q":"test",        "indent":"true",        "wt":"json"}},    "response":{"numFound":0,"start":0,"docs":[]    }}    

or in XML like

  <?xml version="1.0" encoding="UTF-8"?>  <response>    <lst name="responseHeader">    <int name="status">0</int>    <int name="QTime">0</int>    <lst name="params">      <str name="q">test</str>      <str name="indent">true</str>      <str name="wt">html</str>    </lst>  </lst>  <result name="response" numFound="0" start="0">  </result>  </response>    

When I now try the following snippets, I won't get the page contents

  testWindow.document.documentElement.innerHTML    

or

  testWindow.document.documentElement.outerHTML    

what can I do to get the whole page contents and save them into a JS array?

No comments:

Post a Comment