C
Chris Angelico
Using plain CGI is going to be painful -- since /everything/ is handled
a whole new page request. You would have to handle session cookies, etc.
Your "index.html" would attempt to run the JavaScript (note that some
users may have JavaScript turned off -- how will you handle that), if it
gets information it would have to do a "GET index2.html?lat=xxx?long=yyy"
or something similar, which will result in a new page load on the user --
hopefully with a cookie set so you know NOT to run the geolocation code on
subsequent pages.
AJAX is a process to allow JavaScript on the browser to interact with a
server (using XML data structures), and likely use DOM operations in the
browser (and the last time I did something on this nature, I had to have
different code for Internet Explorer vs Firefox, and don't know of
Chrome/Opera share one of the others calls) to make changes on the web page
without doing a full submit/render operation
AJAX changes the client end, but not the server (well, you might
change the server's output format to make it easier, but it's not
essential). So you *can* still use the CGI that you're familiar with.
For reference, Firefox/Chrome/Opera/Safari are all pretty much
identical for this sort of work; and the recent IEs (9, I think, and
10) are following them too. There are trivial differences, but for the
basics, it's possible to support IE8+, Chrome, Firefox back as far as
the Iceweasel from Debian Squeeze (I think that's Ff 3.5), and so on,
all from the same code. No per-browser checks required.
ChrisA