Hi Ivy Team,
From "html-dialog-demos" project
AjaxMethodCallDemo dialog:
<script type="text/javascript">
// jQuery (included in Primefaces) is used to intercept the click on the Button with id #hello
$("#hello").click(function () {
// The ivyajaxapi.js script provides the logic object,
// which contains a funtion for each method available on the dialogs interface.
// If you would like to use the REST API in a more advanced way or without jQuery,
// have a look at the generated ivyajaxapi.js script to see how the REST API is used.
logic.helloWorld(
// The first parameter is a data structure, which represents the list of parameters
{
"name": "World"
},
// The second parameter is a function, which is called on a successful response.
function (returnData) {
// returnData is a JavaScript Object containing one field for each Method return value.
// returnData.result accesses the return value named result.
$("#result").html(returnData.result);
}
);
});
$("#closeDialog").click(function () {
logic.closeDialog();
});
</script>
Questions:
- How can I find the generated file "rest/ivyajaxapi.js" on the designer (Mac)?
- How to handle an error for this function "logic.helloWorld" e.g on the device there is no internet connection or could not connect to server? from the demo I saw only the function to handle the successful response.
Thank you and BR,
Joe