How to add query parameters taken from author to url? | Community
Skip to main content
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Saravanan_Dharmaraj

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>

1 reply

Saravanan_Dharmaraj
New Participant
October 17, 2022

Could you please elaborate more to help?

Manasi29Author
New Participant
October 17, 2022

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.

Saravanan_Dharmaraj
Saravanan_DharmarajAccepted solution
New Participant
October 17, 2022

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>