cancel
Showing results for 
Search instead for 
Did you mean: 

Loading Share components with AJAX

alejandrogarcia
Champ in-the-making
Champ in-the-making
Hi guys,

Do anybody knows if is possible to load Share components/webscripts using AJAX?

If I had to answer my own question I would say NO, because as far as I know FreeMarker templates, directives, components/webscripts and client-side dependencies are processed in the server side. Perhaps somebody knows whether there exists a workaround or something like that.

Thanks in advance.

Regards.
3 REPLIES 3

alejandrogarcia
Champ in-the-making
Champ in-the-making
By the way, forgot to mention I have performing some tests in order to achieve it. If you invoke the component directly with its URL, effectively it returns the corresponding HTML code which you can append to any HTML element using JS. That's OK, the problem is that CSS styles are not applied as they should and client-side widgets are not initialized properly.

Regards.

michaelc
Champ on-the-rise
Champ on-the-rise
much of the Share product uses JavaScript components that work with AJAX.
You can take a service - Clone it - modify to return data as say a JSON object vs HTML.
This would be done in the template pretty much the same way.

Thanks for your answer.

I know what you say, but what I really looking for is to invoke a component using URL and append its content wherever I want. As I said before:

<cite>
By the way, forgot to mention I have performing some tests in order to achieve it. If you invoke the component directly with its URL, effectively it returns the corresponding HTML code which you can append to any HTML element using JS. That's OK, the problem is that CSS styles are not applied as they should and client-side widgets are not initialized properly.

Regards.
</cite>

I believe it should be possible to do as I understand it is what Surf is doing in the background, nevertheless I don't know how CSS and JS dependencies for each component are managed.

Regards.