× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Brad,
There are a lot of things that are used to make AJAX "easy". Those things are
not necessarily "easy" themselves. 
But here's the cliff notes version:

Returning XML to the browser:
Use Javascript to parse out the data elements
Update the <DIV> tag IDs with the data.
There is one <DIV> or <SPAN> tag for each data element, or less than one per
data element. 
You compose the HTML any way you want: Use FrontPage/DreamWeaver and store the
HTML in the HTML page within its own <DIV ID="MYTABLERESULTS"></DIV> tags and
hide that set of HTML (that is the <DIV> tags) until you get the data via an
AJAX call, then show it. Since the HTML is already in the browser--you don't
have to compose it. For example:
  // Get the XMLHttpResponse
  // parse out the nodes until I have the data element(s) I need.
  // Update the innerHTML as follows:
  myTabData.innerHTML = myVarWithHTMLAndData;

Then something like this:
 <DIV ID="MYTABLRESULTS">
  <table><tr><div ID="TABDATA"></div></tr></table>
 </div>

If you need it at a table row-level, then insert <DIV> tags accordingly.

Alternatively, when you populate the <DIV> with the data, you can include HTML.
This is similar to what you're doing in RPG CGI programs. So instead of
assigning MyVarWithHTMLAndData to the <DIV>, you do something like this:
  myDiv.innerHTML = '<td><b>' + theData + '</b></td>';

Similar to what you would do in RPG IV, but anytime you can externalize the HTML
from RPG IV, it's a good thing.
In addition, if you unload all those myriad string copies (implicit copies via
the EVAL opcode in RPG IV) from the CGI program to the Browser, you do get a
snappier response. Doing all the work on the host is okay and works in situation
where you need that kind of control. But for wrapping something in pre-formatted
HTML tags, I prefer to do it in the browser.


-Bob Cozzi
www.iSeriesTV.com
Ask your Manager to watch iSeriesTV.com


-----Original Message-----
From: web400-bounces@xxxxxxxxxxxx [mailto:web400-bounces@xxxxxxxxxxxx] On Behalf
Of Brad Stone
Sent: Friday, September 22, 2006 12:49 PM
To: Web Enabling the AS400 / iSeries
Subject: Re: [WEB400] AJAX...

On Fri, 22 Sep 2006 10:43:37 -0400
 "Bob Cozzi" <cozzi@xxxxxxxxx> wrote:
So, do you return XML and then convert that to HTML?  
Seems like extra work to me.  :)

Nope never.
I insert <div> or <span> tags and just set the innerHTML
of the tag to the new
data--the HTML is created in FrontPage or whatever using
WYSIWYG editing, which
is always easier than trying to compose HTML in RPG IV.

-BOB

Ok, now I'm confused.

Let's say you have a webpage using AJAX.  There is a button
that you click that says "display order history".

When it's clicked, an AJAX CGI app is run and fills the div
or span with the order history list.

The data returned from the CGI app is HTML or XML?  Because
it's created dynamically, FrontPage really wouldn't play a
part.  IF it's XML, it would have to be converted to HTML.
 

I don't think we are on the same page.  :)  But maybe... 

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.