Your browser doesn't support the features required by impress.js, so you are presented with a simplified version of this presentation.

For the best experience please use the latest Chrome, Safari or Firefox browser.

CIS 115

Programming for the Web

Assignments

Blog 4: The Internet's Influence

The internet has been a major force in our lives for several decades now. Write about how the internet has influenced you as a person. Try and think about ways that you would be a different person if you didn’t have the internet. Things you can think about:The internet is a very influential part of our modern culture. Because of this, most of us have been impacted by the internet in some way throughout our lives. For this blog article, write about how the internet has impacted you as an individual, but also how you believe the internet has impacted us as a society in general. (Food for thought: - read about the Filter Bubble or Cyberculture for ideas: https://en.wikipedia.org/wiki/Filter_bubble and https://en.wikipedia.org/wiki/Cyberculture). As you are writing, here are some things you can think about:

Core Web 2.0 Technologies

Document Object Model (DOM)

Image Source: Wikipedia

JavaScript (1995)

AJAX (2005)

Extensible Markup Language (XML)

<person>
   <firstName>John</firstName>
   <lastName>Smith</lastName>
   <age>25</age>
   <address>
      <city>New York</city>
      <postalCode>10021</postalCode>
      <state>NY</state>
      <streetAddress>21 2nd Street</streetAddress>
   </address>
   <phoneNumbers>
      <element>
         <number>212 555-1234</number>
         <type>home</type>
      </element>
      <element>
         <number>646 555-4567</number>
         <type>fax</type>
      </element>
   </phoneNumbers>
</person>

JavaScript Object Notation (JSON)

{
    "firstName": "John",
    "lastName": "Smith",
    "age": 25,
    "address": {
        "streetAddress": "21 2nd Street",
        "city": "New York",
        "state": "NY",
        "postalCode": 10021
    },
    "phoneNumbers": [
        {
            "type": "home",
            "number": "212 555-1234"
        },
        {
            "type": "fax",
            "number": "646 555-4567"
        }
    ]
}

Your First HTML Form

<!DOCTYPE html>
<html>
  <head>
    <title>Homepage</title>
  </head>
  <body>
    <form action="action.php" method="post">
      <p>Your name: <input type="text" name="name" /></p>
      <p>Your age: <input type="text" name="age" /></p>
      <p><input type="submit" /></p>
    </form>
  </body>
</html>

Your First PHP Page

<!DOCTYPE html>
<html>
  <head>
    <title>Homepage</title>
  </head>
  <body>
    <p>Hi <?php echo htmlspecialchars($_POST['name']); ?>.</p>
    <p>You are <?php echo (int)$_POST['age']; ?> years old.</p>
  </body>
</html>

POST Form


AJAX HTML Form

<!DOCTYPE html>
<html>
  <head>
    <title>Homepage</title>
  </head>
  <body>
    <form>
      <p>Your name: <input type="text" id="name" /></p>
      <p>Your age: <input type="text" id="age" /></p>
      <p><input type="submit" id="clickMe" /></p>
    </form>
  </body>
  <-- scripts go here -->
</html>

JQuery (1995)

AJAX Scripts

<script src="//code.jquery.com/jquery-1.12.0.min.js"></script>
<script>
  $('#clickMe').on('click', function(event){
    event.preventDefault();
    $.ajax({
      method: "POST",
      url: "action2.php",
      data: { name: $("#name").val(), age: $("#age").val() },
    })
    .success(function (msg) {
      $("#result").html(msg);
    });
  });
</script>

PHP for AJAX


<p>Hi <?php echo htmlspecialchars($_POST['name']); ?>.</p>
<p>You are <?php echo (int)$_POST['age']; ?> years old.</p>

AJAX Form