[ |../../index.htm#lansa/wamengb3_0150.htm]
You are here:

Requesting a Webroutine

The Lstd.Json.getWebroutine(options) method provides a way for your JavaScript code to call a Webroutine. Any webrouting can be called with this method but only a JSON Response Webroutine can return data to it. The single options parameter is a JavaScript object containing zero or more of the following properties:

Wam

The WAM being called. If not present, the current WAM is used.

webroutine

The Webroutine being called. If not present, the current webroutine is used.

Fields

A JavaScript object containing the input values to send to the Webroutine. For example:
{
     GIVENAME: "William",
     SURNAME: "Shakespeare"
}

Lists

A JavaScript object containing lists to send to the Webroutine. Each list is an array or rows and each row is an object containing column values. For example:
{
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="d3984187-739d-4076-80e9-f3d87c162db0"><ac:plain-text-body><![CDATA[     LIST01: [
]]></ac:plain-text-body></ac:structured-macro>
          {DEPTMENT: "ADM", DEPTDESC: "Administration"},
          {DEPTMENT: "FIN", DEPTDESC: "Finance"}
     ]
}

callback

A JavaScript function that will be called when the Ajax request is completed. This function is only called on successful completion of a call to a JSON Response Webroutine. It will be passed a single parameter containing a Webroutine object that represents the Webroutine output.

 |
Putting it all together, you get something like this:
/* * Get webroutine (Ajax request) * Webroutine (wr) is passed to the callback wrapped in an Lstd.Json.Wr object */ var options = \{      wam: "SampleWam",      webroutine: "Sample1",      fields: \{           GIVENAME: "John",
          SURNAME: "Smith"      \},      lists: \{           LIST01: \[                \{DEPTMENT: "ADM", DEPTDESC: "Administration"\},                \{DEPTMENT: "FIN", DEPTDESC: "Finance"\}           \]      \},      callback: function(wr) \{           // Code to handle the Ajax response goes here      \} \};  Lstd.Json.getWebroutine(options);  
The Webroutine object passed to the callback function contains a number of methods for getting the fields and lists returned from the server.
[ !worddavaf485e25f57cd86bb5b0fc63f3f1b1cc.png|height=32,width=32! |../../index.htm#lansa/wamengb3_0150.htm]