Solved! Go to Solution.
Views
Replies
Total Likes
In your sightly html of the component add the below attribute in your component div tag
Am setitng default value as 10. "perpage" is the property you set in dialog
<div class="mycomponent" data-sly-attribute.data-perpage="${ properties.perpage ? properties.perpage : '10' }"> </div>
In your java script , you can read this simple jquery selector
<script> var perpage = $(".mycomponent").attr("perpage"); //Make a XHR call with perpage value </script>
Could you please elaborate more to help?
I want to add some query parameters to url dynamically. Need to take it from author through dialog and then pass the accessed values as parameters to url with the help of ajax call and Post methods.
For example:
Number of results to be displayed per page have to be taken from author and passed to url as query parameter.
In your sightly html of the component add the below attribute in your component div tag
Am setitng default value as 10. "perpage" is the property you set in dialog
<div class="mycomponent" data-sly-attribute.data-perpage="${ properties.perpage ? properties.perpage : '10' }"> </div>
In your java script , you can read this simple jquery selector
<script> var perpage = $(".mycomponent").attr("perpage"); //Make a XHR call with perpage value </script>
Also if possible can you elaborate how can the same attributes be passed to a servlet doPost method using javascript?