We will add a jQuery (a JavaScript library; more at http://jquery.com/) support to the document and create a jQuery-based, custom JS library.
For the JS library, we will create a separate JavaScript file, status.js
, where the interface JS code will reside to serve interface tasks, such as posting statuses via AJAX and some utility methods for displaying the local date-time. So, let's create our custom JS library:
1. To add the jQuery support from Google Content Delivery Network (CDN) to our document, add the following lines to your
index.php
document heading below the<link>
tag:<script src= "http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"> </script>
With this line, we have the latest jQuery version from the CDN. Note that version 1.7 means the latest available version, which is 1.7.X, unless you have specified the exact number, which is 1.7.2 or greater. Now, our document is jQuery-enabled...