topical media & game development

talk show tell print

basic-xml-14-listing15.htm / htm



  <html>
    <head>
        <title>GET Tester</title>
    <script language="JavaScript">
  function doGet()
  {
      var xdDoc, xhHTTP, sXML
      
      var keyword = searchForm.keyword.value;
  
      sRequest = "http://xml.amazon.com/onca/xml3?t=webservices-20"+
                        "&dev-t=xxxxxxxxxxxxxxxx&KeywordSearch="+keyword+
                        "&mode=books&type=lite&page=1&f=xml";
  
      xdDoc = new ActiveXObject("MSXML.DOMDocument");
  
      xhHTTP = new ActiveXObject("MSXML2.XMLHTTP");
      xhHTTP.open("GET", sRequest, false);
      xhHTTP.send();
      
      xdDoc = xhHTTP.responseXML;
      numResults = xdDoc.selectSingleNode("/ProductInfo/TotalResults").text;
  
      alert("Amazon lists "+numResults+" books on "+keyword+".");
      
  }
    </script>
    </head>
    <body>
      <form name="searchForm" id="searchForm">
        <p>
          What topic would you like to research? <br />
          <input id="keyword" name="keyword" size="45">
        </p>
        <input type="button" value="Send The Request" onclick="doGet()">
      </form>
  </body>
  </html>
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.