Forum Discussion
AdamN
13 years agoKhoros Oracle
Hi mannerheim,
JavaScript is indeed the suggested way for pulling in external content. jQuery and other libraries make it pretty easy to make external requests. I took a quick look at your snippet and it seems to be working as expected, as far as I can tell.
There are probably a few reasons why the result doesn't look very pretty:
- CSS isn't being pulled in from Google, so the same styling isn't getting applied
- The images getting pulled in have relative URLs, so they're pointing to non-existant resources on the community
- Your code snippet is stripping out javascript, which is probably a good thing for security reasons, but could also affect how the content is rendering
- rholder13 years agoAceHas anyone successfully completed this solution? I'm interested in doing something similar on our site.
- HaidongG13 years agoLithium Alumni (Retired)
here is my code working with some JSON Web services.
function callAjax() { LITHIUM.jQuery.ajax({ url: "${ajaxURL}", dataType: 'jsonp', jsonp: 'callback', jsonpCallback: 'callbackFunctionOnceJsonpReturnedProperly', timeout: ${ajaxTimeout}, success: function(){ //alert("success"); }, error: function (jqXHR, textStatus, errorThrown) { ....... } }); } function callbackFunctionOnceJsonpReturnedProperly(data, textStatus, xhr){ if (typeof (data) == 'undefined' || data == null) { alert("jsonpCallback object is null"); return; } var username = data["username"]; }
- cblown12 years agoBoss
We think that Lithium should provide a way to pull external data in server side using Freemarker. Please support our Idea here http://lithosphere.lithium.com/t5/Ideas/Access-to-external-data-sources-via-a-custom-component-endpoint/idi-p/61442
Thanks
Chris