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

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 / 1
August 07, 2009
TABLE OF CONTENTS:
  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
SEARCH DEVARTICLES

TOOLS YOU CAN USE

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

<html>

<head>

</head>

<body>

< -- The HTML elements -- >

 

<script type= "text/JavaScript">

 

< -- Ajax Code -- >

 

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

 

</script>

</body>

</html>

};


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

- More Top jQuery Tutorials for Beginners
- 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

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 8 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials