BIT 116 – Scripting

Basic AJAX, using the Dojo toolkit


Part 1: Basic AJAX

This will be a little bit tricky to play around with, due to security restrictions that prevent the browser from accessing material from different websites within the same page.  In a nutshell, when you download an .HTML page from one website, the browser will allow you to download & run JavaScripts from that same site, and will allow that page to make new connections (AJAX connections) back to that same page.  But the browser prevents you from downloading code from other website, and from making a connection to another website (this prevents scripts from grabbing your credit card info & sending to some hacker's server).

There are a couple ways around this, the 'real' way being that you digitally sign the JavaScript.  Since we're looking to get a quick overview, though, we'll skip that.  Instead, you've got two choices:

  1. Run it on the web server
    (Which is good for seeing what it should do)
  2. Download the .HTML file, AND THE .TXT (TEXT) FILES, put them all in the same directory
    (This is good for playing around with them)

For this ICE, you should create a web page which uses the Dojo toolkit (and the dojo.io.bind call in particular) to retrieve data from the same directory, and use that info to then modify the web page in some way.  An alert would be a good start, but make sure that you can also use the DOM stuff to modify the contents of the web page, as well.