Sending a text message (and more)

Slides:



Advertisements
Similar presentations
Form Handling, Validation and Functions. Form Handling Forms are a graphical user interfaces (GUIs) that enables the interaction between users and servers.
Advertisements

Reading Data in Web Pages tMyn1 Reading Data in Web Pages A very common application of PHP is to have an HTML form gather information from a website's.
JavaScript & jQuery the missing manual Chapter 11
Databases.  Multi-table queries  Join ▪ An SQL JOIN clause is used to combine rows from two or more tables, based on a common field between them. 
Server-side Scripting Powering the webs favourite services.
06/10/2015AJAX 1. 2 Introduction All material from AJAX – what is it? Traditional web pages and operation Examples of AJAX use Creating.
The Post Office Module. Manhattan’s Post Office Module is a private system open only to members of your virtual classroom.
HTML FORMS GET/POST METHODS. HTML FORMS HTML Forms HTML forms are used to pass data to a server. A form can contain input elements like text fields, checkboxes,
Creating PHPs to Insert, Update, and Delete Data CS 320.
Chapter 16 The World Wide Web. FIGURE 16.0.F01: A very, very simple Web page. Courtesy of Dr. Richard Smith.
CHAPTER 8 AJAX & JSON WHAT IS AJAX? Ajax lets you…
Introduction to JavaScript MIS 3502, Spring 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 2/2/2016.
Introduction to AJAX MIS 3502, Spring 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 2/4/2016.
JQuery, JSON, AJAX. AJAX: Async JavaScript & XML In traditional Web coding, to get information from a database or a file on the server –make an HTML form.
Introduction to JavaScript MIS 3502, Fall 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 9/29/2016.
Lesson 11: Web Services and API's
Class03 Introduction to Web Development (Hierarchy and the IDE)
Sessions and cookies MIS 3501 Jeremy Shafer Department of MIS
Tonga Institute of Higher Education IT 141: Information Systems
JavaScript and Ajax (Ajax Tutorial)
Introduction to web development concepts
Data Virtualization Tutorial… CORS and CIS
Sessions and cookies (part 2)
Form Data (part 1) MIS 3502, Fall 2015 Jeremy Shafer Department of MIS
Lesson 11: Web Services & API's
AJAX.
AJAX.
IST256 : Applications Programming for Information Systems
How to introduce polling as a presenter… let’s make it easy for your audience to participate! Example instruction slide for using web voting.
Introduction to AJAX MIS 3502 Jeremy Shafer Department of MIS
Introduction to JavaScript
Introduction to AJAX MIS 3502 Jeremy Shafer Department of MIS
A second look at JavaScript
Getting started with jQuery
Ajax and JSON (jQuery part 2)
Tonga Institute of Higher Education IT 141: Information Systems
Class07 PHP: loops MIS 3501 Jeremy Shafer Department of MIS
MySQL Backup, Transfer and Restore
HTML5 APIs MIS3502 Jeremy Shafer Department of MIS
Unit 6 part 3 Test Javascript Test.
Tonga Institute of Higher Education IT 141: Information Systems
HTML and CSS MIS 2402 Jeremy Shafer Department of MIS
Form Validation, Part 2 (with jQuery, HTML5, and CSS)
JavaScript and the DOM MIS 2402 Jeremy Shafer Department of MIS
Lesson 11: Web Services and API's
Numbers, strings and dates in JavaScript
Sessions and cookies MIS 3501 Jeremy Shafer Department of MIS
MIS JavaScript and API Workshop (Part 3)
Introduction to AJAX and JSON
An Introduction to Animation
MIS JavaScript and API Workshop (Part 2)
Getting started with jQuery
REST APIs Maxwell Furman Department of MIS Fox School of Business
Sending a text message (and more)
An introduction to jQuery
JavaScript objects, functions, and events
Form Data (part 1) MIS3501 Jeremy Shafer Department of MIS
Introduction to JavaScript
An introduction to jQuery
Introduction to MIS3502 MIS 3502 Jeremy Shafer Department of MIS
MVC – Model View Controller
PDO and Arrays MIS 3502 Jeremy Shafer Department of MIS
Introduction to MIS2402 MIS MIS2402 Jeremy Shafer Department of MIS
Getting started with jQuery
An introduction to jQuery
Introduction to AJAX and JSON
Ajax and JSON Jeremy Shafer Department of MIS Fox School of Business
Client-Server Model: Requesting a Web Page
Sending a text message (and more)
Ajax and JSON Jeremy Shafer Department of MIS Fox School of Business
Presentation transcript:

Sending a text message (and more) Jeremy Shafer Department of MIS Fox School of Business Temple University

Before we begin… What the industry needs… What we are struggling to build…

Today we’re going to write code that sends a text message to your phone I don’t know how to do that! Wait, what? Yes, yes you do. What you already know… HTML / CSS JavaScript/jQuery How to get JSON data with $.getJSON What don’t know yet… How to set data with $.post() But we can fix that!

The jQuery post method… This is the callback function that will execute when the Ajax call is a success. The URL to visit $.post(someurl, datatosend, function(result) { things to do}); The data to send One or more commands. The data in result can be used here! The object returned by the post method.

Conventional use of GET and POST As we’ve already seen, HTTP GET is usually used to retrieve data. We need the jQuery $.post method because HTTP POST operations are used to send data to a system. We will send our text message using POST. Web server HTTP GET method is used to retrieve data Browser JavaScript Engine HTTP POST method is used to send (or create) data Database

What’s the plan? For this class, we have identified an external API that can be used to send a text message. It is called Textbelt. See: https://textbelt.com/ We will make an HTML form that holds these things: The phone number we want to send a message to The text message we want to send A hidden field that holds our textbelt API key A button to initiate the action Initially we will use the free / demo API key that textbelt gives us. We will collect all the data on the form, get it ready, and send it to the API. This is “getting ready” process involves something called called serialization. Once we are satisfied that this works, we will use a real API key.

Data Serialization Data serialization is the process of translating structured data into a format that can be stored or transmitted in one computer environment, and then later reconstructed in another computer environment. What is one format for serialized data that we have already seen? Let’s see some serialized data. (sms_demo.zip) And … don’t forget to try console.log() instead of alert()

What’s the point? API for quotes (misdemo) CDN (jQuery) API for authentication (misdemo) CDN (Bootstrap) API for SMS (textbelt) CDN (other ?) API for … the next thing!

Try it, you’ll like it! Use the $.post method to send the_serialized_data to the textbelt API endpoint: https://textbelt.com/text Type in your cell phone number into the form and a message. Click “Send the text” Once you receive the confirmation message, use the real API key. Be sure to define a call back function that receives a variable called “data” Use console.log(data) to inspect the contents of data as it is returned from the API.