Forum Discussion
HaidongG
Lithium Alumni (Retired)
Hi jlutterloh,
sorry, as I know, it is not possible to do this in component (including endpoint result without JavaScript) at this moment.
if you worries about the UI "flashing" effect by including endpoint result with JavaScript, you may want to hide the outter div first, call the endpoint, add generated html and show the div. for exmaple, I created an Endpoint in Studio which reaches some 3-rd party API and generate a HTML, and in my another component, I just do something like this.
<#assign kb_endpoint_url = "/plugins/custom/customer-id-goes-here/community-id-goes-here/endpoint-goes-name-here" /> <@liaAddScript> (function($) { $(document).ready(function() { function callLithiumEndpoint() { $('.my-div-css-class-goes-here').hide(); var jqxhr = $.get("${kb_endpoint_url}" function(data) { console.log("success"); $('.my-div-css-class-goes-here').prepend(data); }) .done(function() { console.log("second success"); }) .fail(function() { console.log("error"); }) .always(function() { console.log("finished"); $('.tmy-div-css-class-goes-here').show(); }); } callLithiumEndpoint(); }); })(LITHIUM.jQuery); </@liaAddScript>
I hope that this is helpful for you.
cblown
12 years agoBoss
Thanks Adam and Haidong. While I can't speak for the OP we are specifically interested in using EndPoints inside Custom Components simply becuase they don't support http.client and EndPoints do :p
Related Content
- 10 years ago
- 8 months ago