@ak86
For hitting the servlet after page load, you can use something similar to:
$(window).load(function() {
// executes when complete page is fully loaded, including all frames, objects and images
alert("window is loaded");
}); or
(function(window, document, Granite, $) {
"use strict";
// This will trigger on page load
$(document).on("foundation-contentloaded", function (e) {
});
})(window, document, Granite, Granite.$);Within the java class you can make the url connect and get the reponse. Code snippet:
URL url = new URL("http://example.com");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("GET");
to get the xml response from the url and once you get the xml reponse, you can use the code snippet similar to https://www.javatpoint.com/convert-xml-to-json-in-java to convert the XML to JSON format.
Thanks