× 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.




Just an FYI for anyone that may want to do a synchronous call to ajax using
ZXML or some other tool.
It's pretty simple, actually, and works great for checking tables for
existence etc.
(and you don't need global variables.)

Make the response pretty small and don't do too much, so it doesn't have to
wait too long.
I think it will timeout after 2 minutes.
With mine, I can't even tell it's waiting.

Create another function. I called mine callSAjax.
(Copy the callAjax to callSAjax).
Change the open from
name.open("GET", url, true);
name.open("GET", url, false);
Get rid of the name.onreadystatechange handler block
Add (as the last line of the function after name.send(null)):
return name.responseText;

You do not need a call back function for this.

Here is a reference link:
http://www.hunlock.com/blogs/Snippets:_Synchronous_AJAX

Here is an example:
DelMsg = callSAjax(url);

Hope this helps someone else, it really helped me!
(Thanks again Walden for your suggestion.)

Craig





-----Original Message-----
From: web400-bounces@xxxxxxxxxxxx [mailto:web400-bounces@xxxxxxxxxxxx] On
Behalf Of Craig Jacobsen
Sent: Tuesday, July 14, 2009 12:54 PM
To: 'Web Enabling the AS400 / iSeries'
Subject: Re: [WEB400] Waiting for Ajax call to fill global variable



Thank you Walden, for your input.
I'm using zxml. I downloaded an update from extjs.com.
I'll go to their site to see if I can make it sync.
If not, rather than putting up the alert msg, I'm thinking I can loop until
DelMsg has data.

Thanks everyone, I always learn something from this group.

Craig

-----Original Message-----
From: web400-bounces@xxxxxxxxxxxx [mailto:web400-bounces@xxxxxxxxxxxx] On
Behalf Of Walden H. Leverich
Sent: Tuesday, July 14, 2009 12:31 PM
To: Web Enabling the AS400 / iSeries
Subject: Re: [WEB400] Waiting for Ajax call to fill global variable

If I'm reading this correctly the async-ness of the callAjax method is
messing you up. You're expecting the DelMsg variable to be populated when
you return from the call to callAjax, but it won't be. For the code to work
the way you have it coded you need to make that a sync call.
That shouldn't be a lot of code changes, where's the callAjax function come
from? I'll bet you can pass a parm that says to make the call sync.


-Walden

--
Walden H Leverich III
Tech Software
(516) 627-3800 x3051
WaldenL@xxxxxxxxxxxxxxx
http://www.TechSoftInc.com

Quiquid latine dictum sit altum viditur.
(Whatever is said in Latin seems profound.)

--
This is the Web Enabling the AS400 / iSeries (WEB400) mailing list To post a
message email: WEB400@xxxxxxxxxxxx To subscribe, unsubscribe, or change list
options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/web400.


--
This is the Web Enabling the AS400 / iSeries (WEB400) mailing list To post a
message email: WEB400@xxxxxxxxxxxx To subscribe, unsubscribe, or change list
options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/web400.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.