~/public_html/demo/AJAX/index.html
|
|
04 | < title >Our Class</ title > |
05 | < link href = "Site.css" rel = "stylesheet" > |
09 | < nav id = "nav01" ></ nav > |
11 | < h1 >Welcome to Our Class</ h1 > |
12 | < h3 >Web Site Main Ingredients:</ h3 > |
14 | < p >Style Sheets (CSS)</ p > |
15 | < p >Computer Code (JavaScript)</ p > |
16 | < p >Live Data (Files and Databases)</ p > |
17 | < footer id = "foot01" ></ footer > |
19 | < script src = "Script.js" ></ script > |
|
~/public_html/demo/AJAX/Student.html
|
|
04 | <title>Our Class</title> |
05 | <link href= "Site.css" rel= "stylesheet" > |
09 | <nav id= "nav01" ></nav> |
13 | <footer id= "foot01" ></footer> |
15 | <script src= "Script.js" ></script> |
17 | var xmlhttp = new XMLHttpRequest( ); |
18 | var url = "StudentMySQL.php" ; |
19 | xmlhttp.onreadystatechange = function ( ) { |
20 | if ( xmlhttp.readyState == 4 && xmlhttp.status == 200 ) { |
21 | myFunction( xmlhttp.responseText ); |
24 | xmlhttp.open( "GET" , url, true ); |
27 | function myFunction( response ) { |
28 | var arr = JSON.parse( response ); |
30 | var out = "<table><tr><th>Name</th>" + |
32 | "<th>Country</th></tr>" ; |
33 | for ( i = 0; i < arr.length; i++ ) { |
34 | out += "<tr><td>" + arr[i].Name + |
35 | "</td><td>" + arr[i].City + |
36 | "</td><td>" + arr[i].Country + |
40 | document.getElementById( "id01" ).innerHTML = out; |
|
~/public_html/demo/AJAX/About.html
|
|
05 | < link href = "Site.css" rel = "stylesheet" > |
09 | < nav id = "nav01" ></ nav > |
12 | < p >Department of Computer Science, UND</ p > |
13 | < footer id = "foot01" ></ footer > |
15 | < script src = "Script.js" ></ script > |
|