I would call my RPG program that I created with green screens using Ajax container. Where to place my PGM and what I have to put URL to the program can be seen?
Thank you for your help!
Call an RPG program with Ajax
-
- New User
- Posts: 15
- Joined: Tue Sep 11, 2012 2:16 pm
- First Name: Djibril
- Last Name: SOW
- Company Name: union5
- Contact:
-
- Experienced User
- Posts: 2711
- Joined: Wed Aug 01, 2012 8:58 am
- First Name: Scott
- Last Name: Klement
- Company Name: Profound Logic
- City: Milwaukee
- State / Province: Wisconsin
Re: Call an RPG program with Ajax
What the AjaxContainer does, essentially, is call a URL (GET request) and put the output in the box. This fires when the screen is rendered.
For example, in the designer, drag an AjaxContainer to your screen. Set the "ajax url" property to something like "/example/myscript.php". (Assuming your ProfoundUI instance is set up to work with PHP). This will run the myscript.php script, and the output will be displayed in the AjaxContainer box.
It can work with any URL, as long as that URL is on the same server/port. To prevent cross-site scripting, browsers do not allow Ajax requests to other URLs (that are not on the same server/port.)
However, we provide a similar widget named "iframe" that does allow requests to another server/port, if that's useful to you.
For example, in the designer, drag an AjaxContainer to your screen. Set the "ajax url" property to something like "/example/myscript.php". (Assuming your ProfoundUI instance is set up to work with PHP). This will run the myscript.php script, and the output will be displayed in the AjaxContainer box.
It can work with any URL, as long as that URL is on the same server/port. To prevent cross-site scripting, browsers do not allow Ajax requests to other URLs (that are not on the same server/port.)
However, we provide a similar widget named "iframe" that does allow requests to another server/port, if that's useful to you.
-
- Experienced User
- Posts: 2711
- Joined: Wed Aug 01, 2012 8:58 am
- First Name: Scott
- Last Name: Klement
- Company Name: Profound Logic
- City: Milwaukee
- State / Province: Wisconsin
Re: Call an RPG program with Ajax
Err... sorry, I just re-read your message and noticed that you want the Ajax Container to call an RPG program that outputs a green-screen?
That's not going to work. Ajax is for calling web applications, not green-screen programs. The program you call with an AjaxContainer (or an iframe, for that matter) needs to output HTML.
Though, I guess it might be possible to make Genie convert your screen to HTML and then embed that in an iframe? But this seems rather convoluted, especially since you're already in the Genie environment. Why not just display the output directly?
Can you explain a bit more of what you're trying to accomplish -- there may be a better/easier way.
Thanks!
That's not going to work. Ajax is for calling web applications, not green-screen programs. The program you call with an AjaxContainer (or an iframe, for that matter) needs to output HTML.
Though, I guess it might be possible to make Genie convert your screen to HTML and then embed that in an iframe? But this seems rather convoluted, especially since you're already in the Genie environment. Why not just display the output directly?
Can you explain a bit more of what you're trying to accomplish -- there may be a better/easier way.
Thanks!
-
- New User
- Posts: 15
- Joined: Tue Sep 11, 2012 2:16 pm
- First Name: Djibril
- Last Name: SOW
- Company Name: union5
- Contact:
Re: Call an RPG program with Ajax
What I would do is as shown in the example:
js: "/ genie / getData.pgm? custid =" + get ("I_5_6");
I call PGM and displays the result in the AjaxContainer.
js: "/ genie / getData.pgm? custid =" + get ("I_5_6");
I call PGM and displays the result in the AjaxContainer.
-
- Experienced User
- Posts: 2711
- Joined: Wed Aug 01, 2012 8:58 am
- First Name: Scott
- Last Name: Klement
- Company Name: Profound Logic
- City: Milwaukee
- State / Province: Wisconsin
Re: Call an RPG program with Ajax
Okay, now I see how you're building the URL to your program.
But, I'm afraid, I'm a little confused, here. I'm going to need your help to understand a few things:
But, I'm afraid, I'm a little confused, here. I'm going to need your help to understand a few things:
- What are you trying to achieve? ...and why?
- What is the /genie/ directory used for? A ScriptAlias? Can you tell me more about how that works? Or post the keywords from the Apache config?
- What does the "getData" program do?
- How does the getData program write it's output? As I said before, this needs to output data in HTML (not output green screens.)
-
- New User
- Posts: 15
- Joined: Tue Sep 11, 2012 2:16 pm
- First Name: Djibril
- Last Name: SOW
- Company Name: union5
- Contact:
Re: Call an RPG program with Ajax
This is an example that I saw in the documentation http://www.profoundlogic.com/docs/displ ... +Container and would like to make such a.
My problem is where to place the program RGP (getData.pgm) that I am creating.
In my program I put a "Hello wordl" simply, without passing parameters to the test.
My problem is where to place the program RGP (getData.pgm) that I am creating.
In my program I put a "Hello wordl" simply, without passing parameters to the test.
-
- New User
- Posts: 15
- Joined: Tue Sep 11, 2012 2:16 pm
- First Name: Djibril
- Last Name: SOW
- Company Name: union5
- Contact:
Re: Call an RPG program with Ajax
I'll be back with more accuracy to my question!
I'm in Genie. I would like to call an RPG program, passing as parameter an field of screen by clicking a button and the program I revisit a "HELLE WORLD".
1) Should I install CGI Dev2?
2) If I put my RPG program in the library "toto", which directive should I put in my apache http.conf of seveur?
3) Do you have a small example of such a program?
Thank you!
I'm in Genie. I would like to call an RPG program, passing as parameter an field of screen by clicking a button and the program I revisit a "HELLE WORLD".
1) Should I install CGI Dev2?
2) If I put my RPG program in the library "toto", which directive should I put in my apache http.conf of seveur?
3) Do you have a small example of such a program?
Thank you!
-
- Experienced User
- Posts: 2711
- Joined: Wed Aug 01, 2012 8:58 am
- First Name: Scott
- Last Name: Klement
- Company Name: Profound Logic
- City: Milwaukee
- State / Province: Wisconsin
Re: Call an RPG program with Ajax
1) It'll work with CGIDEV2 if that's the method you prefer. It'll also work with RPGsp (our tool that's similar to CGIDEV2, but more powerful, and a commercial product) or with plain CGI, or PHP or Java or ... well, anything else, really.
2) The idea behind the Apache directive is to create an "alias" so that a string that's in the URL points to a library. So you could add the following to your httpd.conf (Apache config file):
When someone sends a URL like http://YOUR-SERVER/kaw/MYRPG.pgm it will run the program named MYRPG in the library named TOTO. It knows the library is TOTO because "/kaw" is an alias for '/QSYS.LIB/TOTO.LIB" (Which is the IFS syntax for the TOTO library)
3) Do you know which environment you'll be coding this in? Maybe CGIDEV2? Or PHP? Java? Lua? Python? RPGsp? Perl? Since you can run any URL that outputs data, I'm a bit overwhemed by all of the possibilities, here.
2) The idea behind the Apache directive is to create an "alias" so that a string that's in the URL points to a library. So you could add the following to your httpd.conf (Apache config file):
Code: Select all
ScriptAlias /kaw /qsys.lib/toto.lib
<Directory /qsys.lib/toto.lib>
Order Allow,Deny
Allow from All
</Directory>
3) Do you know which environment you'll be coding this in? Maybe CGIDEV2? Or PHP? Java? Lua? Python? RPGsp? Perl? Since you can run any URL that outputs data, I'm a bit overwhemed by all of the possibilities, here.
Who is online
Users browsing this forum: No registered users and 4 guests