Website Support India - Support for website related issues

Home

Ajax by Example

E-mail Print PDF
User Rating: / 0
PoorBest 


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>Example 1</title>
    <script type="text/javascript">//<![CDATA[
        function makeRequest() {
          var oScript = document.createElement("script");
          oScript.src="/example1.js";
          document.body.appendChild(oScript);
        }

        function callback(sText) {
          alert("Loaded from file: " + sText);
        }
    //]]>
    </script>
  </head>
  <body>
    <input type="button" value="Click Me" onclick="makeRequest()" />
  </body>
</html>

The JavaScript file example1.js contains a single line:

callback("Hello world!");

Last Updated ( Saturday, 19 June 2010 11:53 )  

Login Form