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