search the site  

Enter search terms:


subscribe to newsletters   WebReference.com logo   WebReference.com
dev the Web
tip archive  •   about  •   contact  •   jobs  •   sitemap


[next]

Copy and Paste JavaScript with an Ajax Engine

By Will Bontrager

Digg This Add to del.icio.us

ASP 3.0/.NET Developer
Jupitermedia
US-NY-New York

Justtechjobs.com Post A Job | Post A Resume

It's not necessary to understand the characteristics of Ajax in order to use it. This article provides copy and paste JavaScript with an Ajax engine. No modifications are necessary.

If you really want to get into the nitty-gritty of Ajax, here are a few pages with good information. Google "Ajax tutorial" for more.

Copy the following JavaScript and paste it into the HEAD area of your Web page source code.

The JavaScript could go pretty much anywhere, in the HEAD or BODY area, so long as it's not pasted within other JavaScript or inside an HTML tag. In the HEAD it's easier to manage, with less clutter in the BODY area, where you'll be working with the examples.

Congratulations. You have completed placing JavaScript with an Ajax engine on your Web page.

Now, let's learn how to use it.

Three things are required to use the JavaScript Ajax engine:

  1. The URL(s) of the content to be retrieved.
  2. A place on your Web page to put the content.
  3. A link to trigger the JavaScript, causing it to retrieve the content and put it where you want it.

The URLs of the Content to Be Retrieved

The content to be retrieved can be pretty much whatever you want it to be — text, images, forms, JavaScript, sound — any valid HTML source code.

It's important that the file with the content must be on the same domain as the Web page with the JavaScript Ajax engine. This is a restriction of the JavaScript XMLHttpRequest function, the heart of Ajax. (Work-arounds require relay software on the server. This is addressed later.)

The examples in this article assume you have two files on your server, fileone.html and filetwo.html. They will contain content for the JavaScript Ajax engine to retrieve.

For use in the examples, let fileone.html contain:

And, let filetwo.html contain:

Upload files fileone.html and filetwo.html into the document root of your server (the directory where your domain's main or index Web page file is located). The files could be in other directories. The examples below assume they are in the document root.


[next]

Recent Articles

WebReference.com site name
Perl Pragma Primer
Implement Drag and Drop in Your Web Apps: Part 2
How to Create an Ajax Autocomplete Text Field: Part 5
internet.com site name
SQL Server 2005 Express Edition - Part 22 - Upgrading from Microsoft SQL Server Desktop Engine (MSDE)
Vyatta: Downgrades that Pay Off
NetMotion Brings Cross-Network Support to Wireless VoIP




JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

Solutions
Whitepapers and eBooks
Microsoft Article: HyperV-The Killer Feature in WinServer ‘08
Avaya Article: How to Feed Data into the Avaya Event Processor
Microsoft Article: Install What You Need with Win Server ‘08
HP eBook: Putting the Green into IT
Whitepaper: HP Integrated Citrix XenServer for HP ProLiant Servers
Intel Go Parallel Portal: Interview with C++ Guru Herb Sutter, Part 1
Intel Go Parallel Portal: Interview with C++ Guru Herb Sutter, Part 2--The Future of Concurrency
Avaya Article: Setting Up a SIP A/S Development Environment
IBM Article: How Cool Is Your Data Center?
Microsoft Article: Managing Virtual Machines with Microsoft System Center
HP eBook: Storage Networking , Part 1
Microsoft Article: Solving Data Center Complexity with Microsoft System Center Configuration Manager 2007
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
Webcasts
Intel Video: Are Multi-core Processors Here to Stay?
On-Demand Webcast: Five Virtualization Trends to Watch
HP Video: Page Cost Calculator
Intel Video: APIs for Parallel Programming
HP Webcast: Storage Is Changing Fast - Be Ready or Be Left Behind
Microsoft Silverlight Video: Creating Fading Controls with Expression Design and Expression Blend 2
MORE WEBCASTS, PODCASTS, AND VIDEOS
Downloads and eKits
Sun Download: Solaris 8 Migration Assistant
Sybase Download: SQL Anywhere Developer Edition
Red Gate Download: SQL Backup Pro and free DBA Best Practices eBook
Red Gate Download: SQL Compare Pro 6
Iron Speed Designer Application Generator
MORE DOWNLOADS, EKITS, AND FREE TRIALS
Tutorials and Demos
How-to-Article: Preparing for Hyper-Threading Technology and Dual Core Technology
eTouch PDF: Conquering the Tyranny of E-Mail and Word Processors
IBM Article: Collaborating in the High-Performance Workplace
HP Demo: StorageWorks EVA4400
Intel Featured Algorhythm: Intel Threading Building Blocks--The Pipeline Class
Microsoft How-to Article: Get Going with Silverlight and Windows Live
MORE TUTORIALS, DEMOS AND STEP-BY-STEP GUIDES