Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
messages
  • Loading branch information
rkv14001 committed Apr 10, 2017
1 parent d75bbde commit 99f45c3
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 12 deletions.
16 changes: 4 additions & 12 deletions js/main.js
@@ -1,19 +1,11 @@
var base = "http://phonebk.develop.digitalmediauconn.org/phonebook.php";

function getAllPeople() {
function ajaxCall(uri, callback) {
var ajaxcall = new XMLHttpRequest();

ajaxcall.onreadystatechange = function () {

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

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


}

}
ajaxcall.onreadystatechange = callback;

ajaxcall.open("GET", base + "?do=getAllPeople", true);
ajaxcall.send();
}
}

73 changes: 73 additions & 0 deletions messages/json.html
@@ -0,0 +1,73 @@
<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">

<link rel="apple-touch-icon" href="apple-touch-icon.png">
<!-- Place favicon.ico in the root directory -->

<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/main.css">
<script src="js/vendor/modernizr-2.8.3.min.js"></script>
</head>
<body>
<!--[if lt IE 8]>
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
<![endif]-->

<!-- Add your site or application content here -->
<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>
<script>
function getMessage(targetURL) {
var ajaxcall = new XMLHttpRequest();

ajaxcall.onreadystatechange = function () {

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

var text = JSON.parse(ajaxcall.responseText);
console.log(text);
document.querySelector("#page_title").innerHTML = text.title;
document.querySelector("#page_tagline").innerHTML = text.tagline;
document.querySelector("#page_description").innerHTML = text.description;


}

}
ajaxcall.open("GET", targetURL, true);
ajaxcall.send();
}
getMessage("text.json");



</script>

<!-- Google Analytics: change UA-XXXXX-X to be your site's ID. -->
<script>
(function(b,o,i,l,e,r){b.GoogleAnalyticsObject=l;b[l]||(b[l]=
function(){(b[l].q=b[l].q||[]).push(arguments)});b[l].l=+new Date;
e=o.createElement(i);r=o.getElementsByTagName(i)[0];
e.src='https://www.google-analytics.com/analytics.js';
r.parentNode.insertBefore(e,r)}(window,document,'script','ga'));
ga('create','UA-XXXXX-X','auto');ga('send','pageview');
</script>
</body>
</html>
5 changes: 5 additions & 0 deletions messages/text.json
@@ -0,0 +1,5 @@
{
"title": "Home Page",
"tagline": "This is the tagline",
"description": "this is the description!"
}

0 comments on commit 99f45c3

Please sign in to comment.