A really good source of info on the AJAX side is at 
www.ajaxtoolbox.com, they have a javascript "library" that you can 
download. It's basically a well documented series of javascript 
functions that implement various methods to achieve the result that 
you want. 

I have used it on our 400 to do various inquiries and responses. 
Here's an example which accesses the ajaxtoolbox library:

Need a form FIRST - Note the onSubmit is key here as well as the DIV 
line(where the response text goes):

<form name="form1" action="/yourlibrary/yourprogram.pgm 
method="POST" onSubmit="checkInput(this);return false;">
<input type="text" name="yourfield">
<input type="submit" name="submit" Value="yourvalue">
</form>
<div id="Result_Div" 
style="position:absolute;top:130px;left:0px;width:100%;height:60%;"><
/div>

Next the Javascript that gets called from your form -- note the 
Result_Div.innerHtml line this is where the returned data gets put 
on your HTML - See above:

function checkInput(theform) {
var status = AjaxRequest.submit(
        theform
        ,{
         'onSuccess':function(req)
         {              
                 Result_Div.innerHTML = req.responseText;
                 document.all.Result_Div.style.visibility='visible';
         }
         }
         );
 return status;
}

The above javascript code accesses various functions from the 
ajaxtoolbox library which you can set as an external javascript 
source file. 

Your CGI program, which is the action in the form definition, can 
build the response data which can be an error message or a valid 
return data such as an order or shipment or whatever.

--- In [email protected], "andrew_david_kerr" 
<[EMAIL PROTECTED]> wrote:
>
> Had a look at Bob's article and at the IBM links, which seem 
reasonably 
> clear. The only thing that I am struggling with is how this fits 
in 
> with CGIDEV2, and how we avoid refreshing the whole page, which is 
> exactly what the whole strategy seeks to avoid.
> 
> If we have a simple example: a page is served (a cgi call) which 
has a 
> input field for a customer number. We define a field alongside 
which 
> will serve to display the name if the customer exists or an error 
> message if the customer is not found. So all HTML, including all 
our JS 
> for Ajax is defined in the one html file.
> 
> For the input field, on a defined event we fire our AJAX routine, 
> passing a CGI call address with the customer number as parameter. 
I 
> want to validate this against the iseries db: does this code have 
to 
> exist in our original pgm that was called? How do I write the HTML 
> without erasing the existing page, in terms of the sections? In a 
> previous message and example in the group, it looked to me as if 
the 
> whole page was being rebuilt.
> 
> Hopefully I have explained myself sufficiently clearly!
> 
> Any pointers please?     
> 
> 
> --- In [email protected], pdrula@ wrote:
> >
> > there are 3 articles on IBM site (free registration required):
> > 
> > Mastering Ajax, Part 1: Introduction to Ajax: 
> > http://www-128.ibm.com/developerworks/web/library/wa-
ajaxintro1.html
> > Part 2: http://www-128.ibm.com/developerworks/web/library/wa-
> ajaxintro2/
> > Part 3: 
> > http://www-128.ibm.com/developerworks/web/library/wa-ajaxintro3/?
> ca=dgr-lnxw01MasterAJAX3
> > 
> > I just received (yesterday, from Amazon) "Programmer to 
Programmer - 
> > Professional Ajax" - a real eyes opener, highly recommended! 
> >
>






 
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