cancel
Showing results for 
Search instead for 
Did you mean: 

Calling Web Script from WCM

tolofisto
Champ in-the-making
Champ in-the-making
Hi,
i have created a web script and i would like to know how to call this web script from the website that i have created with the WCM and integrate the web script´s response (wich is HTML) in this web site.

Thank you and regards.
1 REPLY 1

openpj
Elite Collaborator
Elite Collaborator
Tipically using an Ajax call to get all the HTML content generated by your custom webscript, in this way (local GET WebScript example):
<script type="text/javascript">   window.onload = function() {      var webscriptUrl = 'http://localhost:8080/alfresco/service/yourCustomWebScriptUrl';      YAHOO.util.Connect.asyncRequest('GET', webscriptUrl,{         success: function(o) {                  document.getElementById('yourCustomIdElementOnThisHtmlPage').innerHTML=o.responseText;            }      });   }</script>‍‍‍‍‍‍‍‍‍‍‍‍
This script required that you have to build your HTML with a yourCustomIdElementOnThisHtmlPage as a DIV element:
<div id="yourCustomIdElementOnThisHtmlPage">…YOUR CUSTOM WEBSCRIPT OUTPUT WILL BE HERE…</div>‍‍‍‍‍‍‍
Hope this helps.