Still no joy - I enter my customer number, click outside the box, 
press tab and still the Callserver function is not called.

As you can see I've added an alert to Andrew's code at the start of 
the callserver function but it never gets there.

Cheers,

Martin

/$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() {


 alert("Callserver function called");

  var cuno = document.getElementById("cuno").value;

  // Build the URL to connect to
  var url = "/axiscgi/TH3RCGI3.pgm?cuno=" + 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>Get Customer Details</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>


--- In [email protected], "itpweb1" <[EMAIL PROTECTED]> 
wrote:
>
> The onChange event handler is triggered when you change the value 
in
> the text field and move focus from the field by either pressing the
> Tab key or clicking the mouse outside the field. 
> 
> Your Javascript won't complain if something is wrong. It just 
won't do
> anything. Try adding some alerts to try to see what is failing.
> 
> <input type="text" name="cuno" size=5 maxlength=5 
onChange="callServer()">
> 
> some links:
> http://www.webmonkey.com/webmonkey/98/04/index3a_page10.html
> http://ajaxpatterns.org/Explicit_Submission
> http://www.felgall.com/jstip13.htm
> 
> --- In [email protected], "martin_d_welsh"
> <martin.welsh@> wrote:
> >
> > Apologies up front if this is a stupid question (it won't be the 
> > first time!), but when exactly is the callserver function 
actually 
> > called? I'm geting the first screen prompting me for the 
customer 
> > number, but when I enter a number nothing happens. Looking at 
the 
> > AJAX2 object I can see that this has not been called.
> > 
> > Is the callserver function called when you enter the first digit 
or 
> > the last digit or when you press ENTER (surely not)?
> > 
> > Cheers,
> > 
> > Martin
> > 
> > --- In [email protected], "K. Schreur" <schreur@> 
> > wrote:
> > >
> > > I think you are missing a small point. When the page from 
Ajax1 
> > sends the request, the program Ajax 2 is actually sending his 
html 
> > back to the javascript on page ajax 1 that is waiting for it. 
The 
> > javascript on the ajax 1 page is waiting for the reply through 
the 
> > XmlHTTP.onreadystatechange. Once it receives it, the other 
> > javascript is then called to update the existing ajax 1 html 
page. 
> > >   ----- Original Message ----- 
> > >   From: dp 
> > >   To: [email protected] 
> > >   Sent: Monday, March 13, 2006 3:55 PM
> > >   Subject: Re: [Easy400Group] Re: AJAX and iSeries
> > > 
> > > 
> > >   Thanks a lot for the example.  I still have one question.  I 
> > understand how AJAX2 gets the customer # and sends back the 
> > response.  I guess I don't understand how the html stuff on 
> > ajax2.html gets put on ajax1.html's page.  What page do you 
> > reference in your gethtmlifs procedure in ajax2??
> > > 
> > >   Thanks, Doug 
> > > 
> > >   ----- Original Message ----
> > >   From: andrew_david_kerr <andrew_david_kerr@>
> > >   To: [email protected]
> > >   Sent: Monday, March 13, 2006 4:40:31 AM
> > >   Subject: [Easy400Group] Re: AJAX and iSeries
> > > 
> > >   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 = "/cgiprdp/AJAX2.pgm?cuno=" + 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 
> > > 
> > >     a..  Visit your group "Easy400Group" on the web.
> > >       
> > >     b..  To unsubscribe from this group, send an email to:
> > >      [EMAIL PROTECTED]
> > >       
> > >     c..  Your use of Yahoo! Groups is subject to the Yahoo! 
Terms 
> > of Service. 
> > > 
> > > 
> > > ---------------------------------------------------------------
----
> > -----------
> > >
> >
>






 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/Easy400Group/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to