• Fooling around with AJAX for a web app

    Fooling around with AJAX has been on my web programming to-do list for quite some time — like years.  I’ve read bits and pieces on it, but I never had the right project come along at the right time.  Finally the planets aligned. With a series of 15 google calendars, and my task is to make one web page that will allow users to easily navigate between them.  You can see the first working prototype here.  I created a table in MySQL that holds the information on each of the calendars, and a PHP script that delivers the proper Google embed code based which calendar is selected.

    One of the things that kept me from trying AJAX was the idea that it would be too complex — boy was I wrong there.   I struggled most with the Javascript (I just find PHP so much easier to work with!)  The html page and javascript on the client end are matched with PHP on the server.  In my past work I used PHP to deliver full pages — now it just delivers whatever content is needed to fill in some element on the page.  It is actually less work than feeding full pages.  Very cool.  If you’ve been holding off yourself here are some examples to get your started.  Always remember to sanitize your user input — even if you don’t accept user input directly any POST or GET call is an opportunity for the injection of bad stuff.

    Build an Ajax Dropdown Menu – Webmonkey

    In the course of this tutorial, we’re going to look at what Ajax can do. Then we’ll use a JavaScript class to simplify your first steps toward the ultimate in speedy user interactivity.

    PHP Example AJAX and MySQL

    The following example will demonstrate how a web page can fetch information from a database with AJAX technology.

    How to sanitize your php input

    A php class that makes sure your php input is clean…Never trust user input, it may be malicious, always check your php input.

    Related Posts

  • Author: Randy

    In my day job I serve as Information Technology Director for the Yale School of Drama. Otherwise I garden, play guitar, build stuff out of wood, take photos, play around with technology and have been blogging since 2003.

    Share on: LinkedIn

    Stay Informed!

    Did you enjoy this post? Then subscribe to my email newsletter and have the daily posts delivered directly to your inbox. Enter your email address here:

    ADD YOUR COMMENT
    Comments are moderated.

Welcome to RodeWorks

Randall Rode's online home for thoughts, notes, and experiments with a wide range of technology topics. Visit the about page for info on my recent projects and professional background. I welcome your comments!

  • Recent Comments
  • Coming Soon

    New articles are normally posted on Mondays and Wednesdays. Subscribe to the RSS feed or the email update to keep current on the latest posts.

    Site Topics