administration mode

 

Article: Domino AJaX jumpstart »

FERDY CHRISTANT - JAN 6, 2006 (11:28:17 AM)

Introduction

So by now you have heard of this exciting new web development technology called AJaX. Conceptually, you know what it is, and you feel it is time to try this out in Lotus Domino. Instead of trying to understand an advanced code example that is hard to integrate in your own code, you just want some basic hello-world-style examples that you can extend to your own needs. If this is the case, this article will help you.

The demo database

You can either download the database that contains the code, or try it out online:

Basics

AJaX is typically used in one of the following ways:

  • GET: Updating a web page based on remote (XML) data without refreshing the page
  • POST: Submitting data to a web server without refreshing the current web page

This article will focus on the GET scenario. In this scenario, typically the following flow of events occurs:

  1. Users opens the web page
  2. User triggers an event on the page that requires the loading of remote data.
  3. The remote data is retrieved, meanwhile, the user can continue using the page
  4. The received XML is parsed
  5. The parsed result is served to the user without refreshing the page

The demo database delivers four tests that facilitate this flow:

  • Get all XML (Synchonous). This test receives the full remote XML file and outputs it in a messagebox to the user. This is done synchronously, meaning that the browser waits until the XML is received successfully.
  • Get all XML (Asynchonous). This test receives the full remote XML file and outputs it in a messagebox to the user. This is done asynchronously, meaning that the browser continues processing while the XML is being received in the background.
  • Get piece of XML. This test receives the full XML, parses it, and outputs the parsed results in a messagebox.
  • Get XML and update page. This test receives the full XML, parses it, and outputs the result by updating the current page without refreshing it.

If you have downloaded the demo database, you can run the test above by opening the "ajaxget" form in your browser.

Implementation

The implementation of the demo database is quite straightforward, yet here are some details:

The XML that we are using in the test is contained in the page test.xml. Note that the content type of this page is set to application/xml.

When you develop AJaX solutions, the XMLHttpRequest object is crucial. Browser inconsistencies make using this object quite tedious in some cases. Luckily, there is a javascript framework that hides this complexity: Sarissa. Sarissa is used in all of the example code in the database. To make it available to the calling code, the "sarissa.js" javascript library is stored as a file resource design element in the database.

The "ajaxget" form contains all the test logic. In the HTML Head Content section, the reference to the Sarissa library is made. The four tests we described above are implemented as buttons. Click on each button on the form to see the code behind it. This is the most interesting part of the demo database, because you can reuse these pieces of example code for your own implementations. Finally, an HTML div section is placed on the test form, this is the location of the output of test number 4.

Conclusion

I hope that this little article and the demo database helps you in getting started with using AJaX technology in Domino. There are many resources that deal with this subject into much more detail, but sometimes it is good to get a bare working example from which you can move on.

Resources

The list of AJaX resources seems to be endless, but I always remember only one:

www.ajaxpatterns.org

This is a Wiki that contains tons of great links to AJaX resources, including valuable contributions of fellow Lotus bloggers.

BOOKMARK THIS CONTENT
del.icio.us technorati digg Furl YahooMyWeb Reddit NewsVine

Comments: 39
Reviews: 9
Average rating: rating
Highest rating: 5
Lowest rating: 4

COMMENT: KANNAPPAN email

JUL 10, 05:40:12 AM

comment » Thanks for your demo database. It is nice for a beginer to understand 01 «

COMMENT: LUC BETBEDER emailhomepage

AUG 22, 10:25:09 AM

comment » Ferdy,

Nice example db - learnt a lot while unpacking it and using sarissa.

Have one prob with IE ...

In my site I am making a call to a separate db to get my XML from a view using readviewentries ... I simply grab the - easy but...

When I go to this (web)page using HTTPS then the lookup fails (access denied).

BUT It works if I am on the page using HTTP and works both ways HTTP and HTTPS when in Firefox.

Have been looking for a fix all day and only posting this in case you have a simple answer for this issue.

Cheers and thanks for posting a DB example. «

COMMENT: SSS rating

DEC 1, 01:04:22 AM

comment » good «

COMMENT: GIORGIO

DEC 1, 04:13:48 PM

comment » Great sample Ferdy!

Played with it for a while, as always on my home Mac, it works with Firefox but is broken with the standard Safari browser (2.0.4), error is

Value undefined (result of expression oDomDoc.load) is not object.

The incriminated line is:

oDomDoc.load(document.forms[0].DBPath.value + '/test.xml?openpage');

Any suggestion how to make it work with this browser? Thanks! «

COMMENT: POČASÍ homepagerating

DEC 6, 15:16:13

comment » Interesting article «

COMMENT: RAJU J emailrating

JAN 29, 09:27:46 AM

comment » Fine! Very Very useful for beginners..

Will make persons grow more....

Thank You!! 25 «

COMMENT: ERIK

APR 3, 06:48:31 P.M.

comment » Thanks from MEXICO «

COMMENT: DURAIPANDI emailhomepagerating

MAY 2, 08:22:24 AM

comment » Yes. it is very good for the beginers like me 28 «

COMMENT: PATRICK KWINTEN emailhomepage

AUG 16, 07:47:50

comment » Hej, Thanks for the writing, it makes things really clear.

Maybe a bit late posting (so I wonder if you will ever read it) but I have been gooogling for a good explanation/tutorial how you should implement the best known javascripts libraries in Notes/Domino and use them in your application development.

Maybe a suggestion for a great new article?

12 «

COMMENT: TOM rating

OCT 19, 05:37:33 PM

comment » Thank you. «

COMMENT: ROOT123 emailhomepage

NOV 3, 07:15:01 AM

comment » Thanks a lot for the examples. «

COMMENT: SOHBET emailhomepage

NOV 5, 19:19:03

comment » By the way, Jeremiah, double-clicking on a word is supposed to select that word. And if you don’t let go after the second click, you can drag to select the whole sentence or paragraph. It’s very handy when you copy and paste a lot. «

COMMENT: SOHBET emailhomepage

NOV 17, 02:59:38

comment » thanks a lot. «

COMMENT: SOHBET emailhomepage

NOV 26, 11:57:01

comment » thank you «

COMMENT: SOHBET ODALARI emailhomepage

DEC 5, 11:32:27

comment » thank you «

COMMENT: OYUN emailhomepage

JAN 25, 2008 - 00:05:49

comment » thanks you 07

http://www.oyunambari.com «

COMMENT: AŞK ŞIIRLERI emailhomepage

FEB 10, 2008 - 15:26:09

comment » thnks admin veri nice 01 «

COMMENT: DIZI IZLE emailhomepage

FEB 18, 2008 - 03:41:05

comment » very very nice informations... thanks informations.. mr mk «

COMMENT: KALE KASA emailhomepage

FEB 18, 2008 - 10:58:33

comment » thnks admin veri nice 19 «

COMMENT: KALE KAPI emailhomepage

MAR 24, 2008 - 00:29:43

comment » Thanks.. «

COMMENT: DIZI IZLE emailhomepage

MAR 28, 2008 - 17:28:43

comment » thanks you......... «

COMMENT: NONO homepage

MAR 31, 2008 - 18:15:37

comment » Thanks a lot for the very good article. «

COMMENT: XPERT homepagerating

APR 3, 2008 - 18:57:28

comment » Thanks a lot for the examples, very cool ! «

COMMENT: OYUNLAR emailhomepage

APR 4, 2008 - 09:17:28

comment » good article 05 «

COMMENT: DIZI IZLE emailhomepage

APR 10, 2008 - 23:30:23

comment » thanks you..... «

COMMENT: VENUGOPAL REDDY emailhomepage

APR 14, 2008 - 08:10:54 AM

comment » Great....Good Information........ «

COMMENT: DIZI IZLE emailhomepage

APR 22, 2008 - 18:44:20

comment » thanks «

COMMENT: KALE X10 emailhomepage

MAY 14, 2008 - 15:32:43

comment » Maybe a bit late posting (so I wonder if you will ever read it) but I have been gooogling for a good explanation/tutorial how you should implement the best known javascripts libraries in Notes/Domino and use them in your application development. «

COMMENT: VIDEO IZLE emailhomepage

MAY 20, 2008 - 21:43:10

comment » » Fine! Very Very useful for beginners..

Will make persons grow more.... «

COMMENT: SOHBET emailhomepage

MAY 31, 2008 - 21:23:17

comment » tahnx for nice share «

COMMENT: JEFF emailhomepage

JUN 9, 2008 - 10:58:57

comment » Great post «

COMMENT: CENGIZ ÖZDEMIR emailhomepage

JUN 14, 2008 - 00:00:14

comment » Ferdy,

Nice example db - learnt a lot while unpacking it and using sarissa.

Have one prob with IE ...

In my site I am making a call to a separate db to get my XML from a view using readviewentries ... I simply grab the - easy but...

When I go to this (web)page using HTTPS then the lookup fails (access denied).

BUT It works if I am on the page using HTTP and works both ways HTTP and HTTPS when in Firefox.

Have been looking for a fix all day and only posting this in case you have a simple answer for this issue.

Cheers and thanks for posting a DB example. « «

COMMENT: AŞK ŞIIRLERI emailhomepage

JUN 14, 2008 - 20:12:09

comment » Thank you wermac «

COMMENT: BILLIGFLÜGE emailhomepage

JUN 17, 2008 - 22:38:07

comment » Have been looking for a fix all day and only posting this in case you have a simple answer for this issue... «

COMMENT: SOHBET emailhomepagerating

JUN 22, 2008 - 22:56:43

comment » thank you «

COMMENT: MUHABBET emailhomepagerating

JUL 29, 2008 - 08:33:04

comment » thanks you «

COMMENT: SITEMDE emailhomepage

AUG 3, 2008 - 23:25:17

comment » The incriminated line is:

oDomDoc.load(document.forms[0].DBPath.value + '/test.xml?openpage');

how can icorret «

COMMENT: KRIS KALWALA emailrating

AUG 14, 2008 - 13:56:14

comment » cool «

COMMENT: ANTHONY

AUG 15, 2008 - 10:57:19

comment » thks from China... it's good for a beginer «

RATE THIS CONTENT (OPTIONAL)
Was this document useful to you?
 
rating Awesome
rating Good
rating Average
rating Poor
rating Useless
CREATE A NEW COMMENT
required field
required field HTML is not allowed. Hyperlinks will automatically be converted.
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30