Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
ajax call done
  • Loading branch information
rkv14001 committed Apr 7, 2017
1 parent 32b3eb7 commit d75bbde
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 2 deletions.
19 changes: 19 additions & 0 deletions js/main.js
@@ -0,0 +1,19 @@
var base = "http://phonebk.develop.digitalmediauconn.org/phonebook.php";

function getAllPeople() {
var ajaxcall = new XMLHttpRequest();

ajaxcall.onreadystatechange = function () {

if (ajaxcall.readyState == 4 && ajaxcall.status == 200) {

document.querySelector(targetSelector).innerHTML = ajaxcall.responseText;


}

}

ajaxcall.open("GET", base + "?do=getAllPeople", true);
ajaxcall.send();
}
4 changes: 3 additions & 1 deletion messages/css/main.css
@@ -1 +1,3 @@

body {
padding: 30px;
}
1 change: 1 addition & 0 deletions messages/description.txt
@@ -0,0 +1 @@
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut justo elit, cursus sed cursus sit amet, condimentum in sem. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Aenean quis laoreet tellus. Sed hendrerit lectus non gravida congue. Donec auctor semper quam, eu elementum ex efficitur in. Sed vel elit elit. Fusce egestas neque non augue pulvinar, eget facilisis orci pharetra. In sed dictum quam, non auctor libero. Proin facilisis commodo nibh, at aliquam ligula venenatis ut. Vivamus nisi turpis, lacinia ut erat in, venenatis euismod magna.
10 changes: 9 additions & 1 deletion messages/index.html
Expand Up @@ -20,8 +20,16 @@
<![endif]-->

<!-- Add your site or application content here -->
<p>Hello world! This is HTML5 Boilerplate.</p>
<h1 id="page_title">

</h1>

<h2 id="page_tagline">

</h2>

<p id="page_description">
</p>
<script src="https://code.jquery.com/jquery-1.12.0.min.js"></script>
<script>window.jQuery || document.write('<script src="js/vendor/jquery-1.12.0.min.js"><\/script>')</script>
<script src="js/plugins.js"></script>
Expand Down
20 changes: 20 additions & 0 deletions messages/js/main.js
@@ -0,0 +1,20 @@
function getMessage(targetSelector, targetURL) {
var ajaxcall = new XMLHttpRequest();

ajaxcall.onreadystatechange = function () {

if (ajaxcall.readyState == 4 && ajaxcall.status == 200) {

document.querySelector(targetSelector).innerHTML = ajaxcall.responseText;


}

}

ajaxcall.open("GET", targetURL, true);
ajaxcall.send();
}
getMessage("#page_title", "title.txt");
getMessage("#page_tagline", "tagline.txt");
getMessage("#page_description", "description.txt");
1 change: 1 addition & 0 deletions messages/tagline.txt
@@ -0,0 +1 @@
Good ol' lorem ipsum
1 change: 1 addition & 0 deletions messages/title.txt
@@ -0,0 +1 @@
Potens Nominis

0 comments on commit d75bbde

Please sign in to comment.