Home arrow JavaScript arrow Active Client Pages: Simple Document Phase Example Continued

Active Client Pages: Simple Document Phase Example Continued

In this sixth part of a twelve-part series on Active Client Pages (ACP), we complete the simple example that illustrates the Document phase of Chrys’s Approach. You need good knowledge of HTML, JavaScript and Perl to understand this part of the series.

Author Info:
By: Chrysanthus Forcha
Rating: 5 stars5 stars5 stars5 stars5 stars / 5
August 07, 2009
  1. · Active Client Pages: Simple Document Phase Example Continued
  2. · The Code Segments
  3. · The JavaScript Code Segment
  4. · The Content of the Third Page

print this article

Active Client Pages: Simple Document Phase Example Continued
(Page 1 of 4 )

Simple Document Phase Example Continued

The page2Doc Content

We are still dealing with the code for the master page. Remember that the content of the page2Doc variable is the downloaded string, which in our simple example is the HTML content (including its JavaScript). This string is actually prepared using Perl. It resides in a Perl file called sendPge2Str.pl in the cgi-bin directory in the server. The Ajax code segment in the master page downloads this string.

Skeleton of the page2Doc String at Server

This is the skeleton of the content of the sendPge2Str.pl file at the server.

$returnStr = qq{





< -- The HTML elements -- >


<script type= "text/JavaScript">


< -- Ajax Code -- >


< -- Function to develop and load the third page -- >






print $returnStr;

There are two Perl statements here. The first one declares the $returnStr variable and assigns the string that has the second page content to it. The other Perl statement is “print $returnStr;”. The statement sends the string to the browser at the Ajax code segment in the master page.

Take a close look at the string declaration. In simplified form, it is

$returnStr = qq{string content};

The double q (qq) precedes the block with the {} brackets. The double q with the {} brackets form what is called the quoting operator in Perl. It is denoted by qq{}. Everything inside the curly brackets is interpreted as a string. So with the qq{} operator, the content in the block can have quotation marks; you do not have to escape any entity in the block.

The content in the qq{} operator above is the HTML document for the second page at the browser. You type everything in the qq{} operator exactly as you would for the HTML document. Do not escape anything. There are two main code segments in the BODY element (in this file). The first one is for the HTML elements. The second one is a JavaScript. This JavaScript has two sub code segments.

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-2019 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials