Itp - see this page http://developer.mozilla.org/en/docs/AJAX:Getting_Started 

----- Original Message ----
From: itpweb1 <[EMAIL PROTECTED]>
To: [email protected]
Sent: Tuesday, March 21, 2006 9:32:32 AM
Subject: [Easy400Group] Re: AJAX and iSeries

Got it working. Thanks Andrew!

I then tried to extend example to Mozilla based browsers with
XMLHttpRequest() API but can't seem to get it to work. Anyone try this?

Also I found that on IE browser is caching data. I have to close &
re-open browser to get updated data. This is not a good feature. Is
there a switch to force a refresh?

itp


--- In [email protected], "andrew_david_kerr"
<[EMAIL PROTECTED]> wrote:
>
> A very simple example, but as you say once one works...
>
> My ajax1.pgm simply outputs a page with an input box for a customer
> number. WIth a change in this box, it fires a request for other
> customer info (ajax2.pgm) back to the 400. You will see in the
> updatePage function that it splits up the string that comes back from
> the 400: we tell it that have used the "|" to indicate the break
> between data items.
>
> /$top                
> Content-type: text/html
>
> <script TYPE="text/_JavaScript">
>
> var xmlHttp = false;
> try {
>   xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
> } catch (e) {
>   try {
>     xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
>   } catch (e2) {
>     xmlHttp = false;
>   }
> }
>
> function callServer() {
>
>   var cuno = document.getElementById("cuno").value;
>
>   // Build the URL to connect to
>   var url = "" + escape(cuno);
>
>   // Open a connection to the server
>   xmlHttp.open("GET", url, true);
>
>   // Setup a function for the server to run when it's done
>   xmlHttp._onreadystatechange = updatePage;
>
>   // Send the request
>   xmlHttp.send(null);
> }
>
> function updatePage() {
>   if (xmlHttp.readyState == 4) {
>     var response = xmlHttp.responseText.split("|");
>     Cust_Name.innerHTML = response[0];
>     Cust_Group.innerHTML = "Customer Group__: " + response[1];
>   }
> }
>
> </script>
>
> <html>
>
> <head>
> <title>AJAX *** TEST ***</title>
>
> </head>
>
> <body>
> <table border=0>
> <tr><td>Customer Number_: <input type="text" name=cuno size=10
> maxlength=10 _onChange="callServer()"></td><td><div id="Cust_Name"
> ></div></td>
> </tr>
> <tr> <td><div id="Cust_Group" ></div></td> <td></td>
> </tr>
> </table>
>       
> /$end                
> </body>
> </html>
>
> The ajax2 program simply looks to a customer master file with the
> given number and returns 2 items of data relating to that customer.
> It then does
>
> callp wrtsection('top');  
> callp wrtsection('end');  
> callp wrtsection('*fini');
>
> The html for ajax2 only contains the following
>
> /$top                
> Content-type: text/html
>        
> /$end                
> /%cunm%/|/%cucl%/
>
> So the response text just comes back as one long string. If you
> wanted to return multiple lines, if would just be a case of deciding
> on another character for identifying lines breaks, and writing the
> _javascript to break it up. That previous link that I gave
> (onlamp.com) gives a great example of that. Hope this helps!
>
> --- In [email protected], dp <iltgiltg@> wrote:
> >
> > Andrew - congrats!  I'm having a hard time putting it all together
> as I'm not very fluent in _Javascript.  Would you be so kind to
> upload your HTML and RPGILE program.  Once I get one to work, the
> others should fall neatly into place.  THANKS!
> >
>





SPONSORED LINKS
How to format a computer hard drive Cobol programmer Iseries 400
How to format a computer


YAHOO! GROUPS LINKS




Reply via email to