Page 189 - Computer Software Application TP - Volume 1
P. 189

COMPUTER SOFTWARE APPLICATION - CITS




              3  Save the program in C:\Apache24\htdocs in a folder as script.js
           II  Create an HTML file with an empty container for displaying content and a button to trigger the AJAX
              request.

              1  Open the text editor
              2  Write the following codes
                 <html >
                 <head>
                 <title>AJAX Example</title>
                 </head>

                 <body>
                 <button id=”loadButton”>Load Content</button>
                 <div id=”contentContainer”></div>
                 <script src=”script.js”></script>

                 </body>
                 </html>
              3  Save the program in C:\Apache24\htdocs in a folder as ajaxtest.html
           III  Test the application
              1  Create a text file named example.txt in the same directory as your HTML file.

                      (This file will contain the content to load dynamically.)
              2  Run the Apache services from windows services
              3  Open your HTML file in a web browser and click the “Load Content” button.
              4  verify the output











           1  Create a JavaScript program that sends form data to a server using AJAX when the form is submitted. Display
              a success message to the user upon successful submission.
           2  Write a JavaScript program that uses AJAX to fetch data from a JSON file and display it on a webpage.

























                                                           174

                               CITS : IT & ITES - Computer Software Application - Exercise 46
   184   185   186   187   188   189   190   191   192   193   194