Ajax call to USE-API script | Community
Skip to main content
July 16, 2021
Solved

Ajax call to USE-API script

  • July 16, 2021
  • 2 replies
  • 2266 views

I have an RTE in my dialog with a link plugin, that would update some values data-foo & data-bar and store them along as part of the anchor tag in a property on save. data-foo and data-bar are completely dependent upon the href value mentioned by user in the link dialog. To generate both the values, I have a logic built using a use-api script that has access to the ResourceResolver and Externalizer classes. Is it possible for us to send an ajax call or any other request to the server with the href value as argument from the dialog.

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 arunpatidar

Hi,

You can make a call to sling servlet which will return the data attribute value

e.g. https://aemlab.blogspot.com/2019/07/aem-rte-custom-plugins-1.html

http://experience-aem.blogspot.com/2017/09/aem-63-touch-ui-extend-rich-text-link-dialog-add-rel-select.html

 

2 replies

arunpatidar
Community Advisor
arunpatidarCommunity AdvisorAccepted solution
Community Advisor
July 17, 2021
PremIBAuthor
July 19, 2021
@arunpatidar but the use api script i've mentioned in is a javascript use api script. It also accepts some values as arguments. is it possible to execute this javascript use api script from a servlet then?
shelly-goel
Adobe Employee
Adobe Employee
July 18, 2021

@premib  Did you try to make this ajax call from the same use-api script where you're creating data-foo & data-bar? That should have the href value already.

PremIBAuthor
July 19, 2021
@shelly-goel I do not understand why I should be making a call from the use-api script again to the same script. My intention here is to call the backend script from frontend javascript. is it possible?