Register | Login | |||||
Main
| Memberlist
| Active users
| ACS
| Commons
| Calendar
| Online users Ranks | FAQ | Color Chart | Photo album | IRC Chat |
| |
0 user currently in Acmlmboard support?. |
Acmlm's Board - I2 Archive - Acmlmboard support? - Asynchronous Javascript and XML + Acmlmboard: A small real world example. | | | |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread |
User | Post | ||
BillyGraham21 Micro-Goomba Level: 5 Posts: 5/10 EXP: 363 For next: 166 Since: 06-23-05 Since last post: 47 days Last activity: 13 hours |
| ||
Asynchronous Javascript and XML + Acmlmboard: A small real world example. Recently I have been meddling in the oft-popular and equally over-used buzzword branch of programming, "AJAX" (okay, not as much as fucking Ruby, but still..). Asynchronous Javascript and XML. Pertaining to web-browsers that support the XMLHttprequest command/method/object. It's what makes the world, and Google, "go round"; an excellent example is Google Maps. AJAX itself is nothing new nor particularily novel. AJAX setups allow web applications to retrieve and append data to the currently viewed page without reloading. I worked a very brief example of XMLHttprequest into a PHP forum system which I have been creating on and off for the past few months and decided to also work it into the Acmlm board in a very small way: the registration system. Now, this really isn't as useful or as practical for the way the current registration process occurs, but it is no doubt a much needed feature on many other online registration forms. You know the type: you fill out about 30 forms worth of information, half of them non-cachable sensitive pieces of data, only to hit the "submit" button to find out that your username is taken. Well, frankly that pisses me off to no end. You hit the back button and half of the form (if you're lucky) needs to be refilled completely and you have to hope again that you pick a username that isn't taken. This is a very simple solution to that problem. Using a small combination of the existing registration script, PHP+SQL, and Javascript, you can query the existing userbase for your desired name and--without refreshing the page--find out if it is available. I've made two quick screenshots to show basically what you'll see. You interact by simply clicking the link, and the data appends itself: before, and after. The additions themselves are very simple and straitforward with little changes to the actual base system (which is good considering the incredibly convoluted nature of the pre): 1) Navigate to pre lines 43-45, insert bold statement:
Because?: includes the script in the document. 2) Navigate to pre line 48, insert bold statement:
Because?: activates script and provides an area for the returned content to be displayed. 3) Navigate to pre line 50, insert bold statement:
Because?: We use the getElementById(); javascript function. That's it, very quick and painless as far as the pre additions to the acmlmboard itself are concerned. Next, you just need to place two scripts: 1) The first script, 'check_for_username.js', should be moved into the /lib/ directory. This script contains the XMLHttprequest object functions. 2) The next script is 'check_for_username.php', to be placed into the root directory of the board software. This script is called by the XMLHttprequest object and queries the existing SQL database for usernames. I have the files directly available for download to place/overwrite for the last released Acmlmboard version 1.A2, and I've also commented and included the Javascript and PHP pre in case you want to patch another existing version. Any comments, questions, or bugs can be addressed in this thread. check_for_username.js//will hold the retrieved content check_for_username.php<?php (edited by BillyGraham21 on 06-25-05 07:09 PM) |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread |
Acmlm's Board - I2 Archive - Acmlmboard support? - Asynchronous Javascript and XML + Acmlmboard: A small real world example. | | | |