Applied Math & Computer Science Lab
Data Analysis, Optimization & Mathematical Modeling, Artificial Intelligence, Neural Net For Everyday Life Applications
Links Online Free Courses Bookstore Forum Submit Link New Additions Archive
Search the Web:    

Ajax example with perl, MySQL, CGI::Ajax

Ajax programming allows to develop more interactive web pages and put more intelligence to web page. In this article we consider how it can be implemented with perl , CGI::Ajax module, MySQL database. CGI::Ajax module make ajax programming much easy for us. MySQL database is common choice of back-end database software for web applications that are developed in perl or php.
Consider the following task. When the user types some search keywords in the search textbox the search string should be changed. For example when someone entered 'perl source code' it could be useful also to include 'perl script' or 'perl program'.
The simplified script for the task above is provided below in the link section. The function lookup is associated with OnKeyUp event for search textbox through following lines:

my $ajax = CGI::Ajax->new( 'do_lookup' => &lookup );

the next line is from the textbox tag :
OnKeyUp="do_lookup(['input_text','NO_CACHE'],['out_layer']);"

The function lookup opens MySQL database, searches for inputted word and returns what it found. The output of this function is printed to out_layer. The user can click on this layer and seach box will be updated. This is very simple and basic example of ajax with perl, CGI::Ajax, MySQL database. In the future it probably will be updated with out_layer to allow multiple rows and also more intelligence will be added.

References



1. Ajax example with perl, MySQL, CGI::Ajax

External Links on the Web

2.CGI::Ajax from CPAN
3.Wikipedia - Ajax programming
4.Using Ajax from Perl by Dominic Mitchell
5.Simple Example demonstrating Ajax Implementation using Perl
6.Autocomplete search example based on Wordnet 3.0