how to call servlet via ajax immediate after closing dialog and saving nodes in jcr.
i have requirement to call servlet using dialog data stored in jcr content path immediately dialog is closed.
Solved! Go to Solution.
Views
Replies
Total Likes
A hack would be to add delay in calling the function.
The other option which is more reliable would be to use a resourceListener on node addition/updation.
Hi @sudarshanreddy ,
You can use following in your component clientlib-JS:
(function(document, $, ns) { "use strict"; $(document).on("click", ".cq-dialog-submit", function(e) { $.ajax({ type: 'GET', url: '/your/servlet/path', data: { text: "TEXT", heading: "HEADING" }, success: function(msg) { alert('success'); } }); }); })(document, Granite.$, Granite.author);
Hope this helps, thanks!
$(document).on("click", ".cq-dialog-submit", function(e) {
servlet call will be made before node creation in jcr content folder.
looking for servlet call after creating/saving content
A hack would be to add delay in calling the function.
The other option which is more reliable would be to use a resourceListener on node addition/updation.
There are different events you can leverage
just tried everything, its not working... always servlet will be called before saving content into jcr.
you can't call servlet after the saving value but you can write event listener to do same thing that you want to do using servlet.
In your use case, I would suggest you to use Event Listener on node addition.
Views
Likes
Replies
Views
Like
Replies