topical media & game development

talk show tell print

professional-javascript-16-CrossBrowserHttpRequestExample2.htm / htm



  <html>
      <head>
          <title>Cross-Browser HTTP Request Example</title>
          <script type="text/javascript" src="http.js"></script>
          <script type="text/javascript">               
                  
                  function getServerInfo() {
                      var sURL = "http://localhost/reflectpost.php";
                      var sParams = "";
                      sParams = addPostParam(sParams, "name", "Nicholas");
                      sParams = addPostParam(sParams, "book", "Professional JavaScript");
                      
                      Http.post(sURL, sParams, function (sData) {
                          alert("Data from server: " + sData);
                      });
  
                  }
  
          </script>
      </head>
      <body>
          <p>Click the button to make a POST request. This example will only work
          on a Web server. You must replace <code>http://localhost/example.txt>
          with the appropriate location of a file on your server.</p>
          
          <input type="button" onclick="getServerInfo()" value="Get Server info" />
      </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.