Am using server-side JavaScript USE API to read the dialog properties like below
use(function () {
var myproperty = properties.get("renderpagetype");
return { callajaxvariable: myproperty,
};
});
How to pass/get this dialog property value and call an AJAX request in sightly.? (i.e. i need the dialog value which has been retrieved by JS USE API into a page level Java script usage).
Here is a very simple example of what you are trying to achieve based on your question:
simple.js
use(function () {
var myproperty = properties.get("renderpagetype");
return {callajaxvariable: myproperty};
});
simple.html
// simple.html
<script data-sly-use.simple="simple.js">
/* assuming you use jquery */
$.ajax({
method: "POST",
url: "/path/to/backend/servlet",
someParam: "${simple.callajaxvariable @ context='scriptString'}"
})
</script>