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

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
  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

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

- Project Nashorn to Make Java, JavaScript Wor...
- JavaScript Virus Attacks Tumblr Blogs
- Google Releases Stable Dart Version, JavaScr...
- Khan Academy Unveils New JavaScript Learning...
- Accessing Nitro? There`s an App for That
- JQuery 2.0 Leaving Older IE Versions Behind
- Fastest JavaScript Engine Might Surprise You
- Microsoft Adjusting Chakra for IE 10
- Brendan Eich: We Don`t Need Google Native Cl...
- An Overview of JavaScript Statements
- An Overview of JavaScript Operators
- Overview of JavaScript Variables
- More of the Top jQuery Social Plugins
- The Top jQuery Social Plugins
- More of the Top jQuery Slider Plugins

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 

Developer Shed Affiliates


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