Calling Server Routine from HTML/Javascript
-
caseywhite
- Posts: 192
- Joined: Thu May 26, 2016 1:17 am
Calling Server Routine from HTML/Javascript
If I have a static HTML page as the home page with the user/password fields and a login button, is there an easy way to call a VL SRVROUTINE that will validate the user and password. That SRVROUTINE will then do *WEBPAGE response to take the user to the VL Web home page.
This is a more generic question though of how to call SRVROUTINEs from something other than a VL Web page or reusable part.
Is it possible. Is there any info int he docs about this?
This is a more generic question though of how to call SRVROUTINEs from something other than a VL Web page or reusable part.
Is it possible. Is there any info int he docs about this?
Re: Calling Server Routine from HTML/Javascript
Search the docs.lansa.com for JSON Convenience Wrapper
Whilst this is specifically for talking to WAM (webroutines), the mechanism is basically identical for SRVROUTINEs.
Whilst this is specifically for talking to WAM (webroutines), the mechanism is basically identical for SRVROUTINEs.
-
caseywhite
- Posts: 192
- Joined: Thu May 26, 2016 1:17 am
Re: Calling Server Routine from HTML/Javascript
Thanks. Will take a look.
Re: Calling Server Routine from HTML/Javascript
What is a SRVROUTINE response of *WEBPAGE. I can find a few references to but no full explanatiom of how it works.
- Stewart Marshall
- Posts: 417
- Joined: Thu Nov 05, 2015 5:25 pm
Re: Calling Server Routine from HTML/Javascript
By default, a SRVRoutine returns the data as JSON, meaning that the web application works more like a traditional client server app.
*WebPage, followed by the name of the desired WebPage, means that you get a completely new page served to the browser.
*WebPage, followed by the name of the desired WebPage, means that you get a completely new page served to the browser.
Re: Calling Server Routine from HTML/Javascript
Thanks Stewart
Would that be a static web page xxxx.html served off the current server or any arbitrary page eg. www.smh.com.au?
Are there any examples anywhere?
Would that be a static web page xxxx.html served off the current server or any arbitrary page eg. www.smh.com.au?
Are there any examples anywhere?
- Stewart Marshall
- Posts: 417
- Joined: Thu Nov 05, 2015 5:25 pm
Re: Calling Server Routine from HTML/Javascript
Hi Jim
It's neither of those. It's a WebPage component.
An example might be that you use the first page to manage signing in to the application. Assuming success, you can execute the SRVRoutine. This will then return the new page, completely replacing the signon page.
If you want to navigate to a static page or a different domain
Regards
It's neither of those. It's a WebPage component.
Code: Select all
Srvroutine Name(SignedIn) Response(*WebPage #MainApplicationWebPage)
Endroutine
If you want to navigate to a static page or a different domain
Code: Select all
#sys_web.Navigate( "http://www.smh.com.au" Current )
-
caseywhite
- Posts: 192
- Joined: Thu May 26, 2016 1:17 am
Re: Calling Server Routine from HTML/Javascript
Stewart, would I use the same JSON convenience wrapper from a WAM if I want to call a Web Page and Post parms? The Web Page and WAM will be in the same session and needs to be able to post some parms to the web page. I don't want to pass them in the URL. Is there an easy way in a push button weblet to call a server routine or is the JSON convenience wrapper the only way for a WAM to call a server module that that then redirects to a web page.
-
dannyoorburg
- Posts: 177
- Joined: Mon Jan 04, 2016 9:50 am
- Location: Australia
Re: Calling Server Routine from HTML/Javascript
Hi,
I think you can.
I'm pretty sure you can just pass in ServerModule/ServerRoutine where you would normally pass WAM/WebRoutine to the push button Weblet and have your ServerRoutine return a WebPage component as the next page.
Give it a try.
Cheers,
Danny
I think you can.
I'm pretty sure you can just pass in ServerModule/ServerRoutine where you would normally pass WAM/WebRoutine to the push button Weblet and have your ServerRoutine return a WebPage component as the next page.
Give it a try.
Cheers,
Danny
-
caseywhite
- Posts: 192
- Joined: Thu May 26, 2016 1:17 am
Re: Calling Server Routine from HTML/Javascript
I tried that before posting but had an issue so thought it wasn't supported. Realized that you cannot use the name in the WAM/Webroutine of the push button but instead must use the ID of the WAM. Now it works. Thanks.