Ajax Method Call APIΒΆ

Methods of a Html Dialog can be called with JavaScript through a REST like interface. This Ajax method call API of Axon.ivy can be used to integrate JavaScript libraries like D3, jQuery or your own JavaScript scripts. See the Ajax Method Call Demo in the Html Dialog Demo Project:

 1<script type="text/javascript">
 2  // jQuery is used to intercept the click on the Button with id #hello
 3  $("#hello").click(function () {
 4
 5    // The ivyajaxapi.js script provides the logic object, 
 6    // which contains a function for each method available on the dialogs interface.
 7    // If you would like to use the REST API in a more advanced way or without jQuery, 
 8    // have a look at the generated ivyajaxapi.js script to see how the REST API is used.
 9    logic.helloWorld(
10
11      // The first parameter is a data structure, which represents the list of parameters
12      { "name": "World" },
13
14      // The second parameter is a function, which is called on a successful response.
15      function (returnData) {
16        // returnData is a JavaScript Object containing one field for each Method return value.
17        // returnData.result accesses the return value named result.
18        $("#result").html(returnData.result);
19      });
20  });
21</script>