Home arrow JavaScript arrow JavaScript Remote Scripting: Building an AJAX-based Random Code Generator
JAVASCRIPT

JavaScript Remote Scripting: Building an AJAX-based Random Code Generator


This article explains how to build a random code generator, specifically applied to a voting system. This will help you to avoid system hacks involving automated submissions.

Author Info:
By: Alejandro Gervasio
Rating: 4 stars4 stars4 stars4 stars4 stars / 14
October 19, 2005
TABLE OF CONTENTS:
  1. · JavaScript Remote Scripting: Building an AJAX-based Random Code Generator
  2. · Protecting against automated data submission: the basics of a random data generator
  3. · Implementing the core logic of the script: defining the “statusChecker()” function
  4. · Avoiding simultaneous data submission: coding the “removeActiveNodes()” function

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
JavaScript Remote Scripting: Building an AJAX-based Random Code Generator
(Page 1 of 4 )

This is part four of the series “JavaScript Remote Scripting.” Welcome back. As you probably remember, over the previous tutorial I explained how to use standard DOM methods for fetching server-side parsed XML files and displaying their contents on a browser. Since most remote scripting concepts are best understood by example, I followed a practical approximation by exploring the makings of a JavaScript-based application aimed at displaying some headlines, which were originally structured as XML nodes within a data file.

Whether you’re wishing to go through the implementation of simple JavaScript snippets for sending silent http requests on the fly and provide visitors with richer interactivity, or building a full-featured application that relies heavily on XML for running a Web service, remote scripting based on JavaScript can bring you additional functionality without the need to mess up programming logic with “dirty” code for handling overlapped application layers.

Now, by taking another look at the series of practical examples that I showed in my previous articles, in this part of the tutorial, I’ll go through the required explanations –- of course, accompanied by the appropriate source code -- for developing a random code generator, specifically applied to a voting system, similar to many applications that you can find on the Web today. Certainly, for the sake of clarity, let me explain first what you’ll find out in this article: I’m not going to demonstrate how to build a full-blown voting system, since that’s out of the scope of this tutorial. Instead, I’ll show you how to add some boxes populated with challenge values (generated on the server). This will avoid leaving the system, which requires a user to enter data manually, vulnerable to being hacked with automated submissions.

The main advantage of implementing such as protecting mechanism is that you can develop your voting system (or another application) by coding all the required data validation on the server, while maintaining the extra functionality offered by JavaScript only on browsers with scripting enabled. By writing the application from that programming point of view, you can make sure that the security of the program, as well as its overall operability, is never compromised by the availability (or not) of JavaScript in the client.

Having detailed the key concepts for applying remote scripting on a random data generator, it’s time to move on and start coding the application. Let’s go!


blog comments powered by Disqus
JAVASCRIPT ARTICLES

- More Top jQuery Plugins for Menus
- Top jQuery Tutorials for Beginners
- New UI Framework and SDK for JavaScript Rele...
- JavaScript OpenPGP Tool, Node.js 0.6.3 Avail...
- Yahoo Releases Cocktails Language and Develo...
- Customizing jQuery Slideshows: Dynamic Contr...
- Customizing jQuery Slideshows: the animate()...
- Customizing jQuery Slideshows: slideUp() and...
- Customizing jQuery Slideshows: hide() and sh...
- Web Workers: Performing Calculations in Para...
- More Top JavaScript Frameworks and Libraries
- More Dynamic jQuery Styling Techniques
- The Top JavaScript Libraries
- The Top JavaScript Frameworks
- Dynamic jQuery Styling

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 10 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials