09-27-2017 05:23 AM
Hi,
I am trying to connect the external web service from my alfresco site to fetch the data and update that data in the ftl file. While connecting the external web service I am getting error like "Communication Failed". Please check the below code, If I made any mistake in this.
Steps followed:
Step 1: create the site-profile.get.html.ftl in below path "alfresco-home\tomcat\webapps\share\WEB-INF\classes\alfresco\site-webscripts\org\alfresco\components\dashlets". In this file I have referred the js file "site-profile.js"
<@script type="text/javascript" src="${url.context}/res/components/dashlets/site-profile.js" group="dashlets"/>
Step 2 : created the site-profile.js in below path "alfresco-home\tomcat\webapps\share\components\dashlets"
$(document).ready(function(){
$(".viewMoreBtn").on('click',function(){
updateList();
$("#viewMoreSiteProfile").modal("show");
});
});
function updateList(){
Alfresco.util.Ajax.request({
url: "http://services.groupkt.com/state/get/IND/UP",
method: Alfresco.util.Ajax.GET,
headers: ('Access-Control-Allow-Origin: *'),
headers: ('Access-Control-Request-Headers: *'),
headers: ('Access-Control-Allow-Methods: *'),
requestContentType: Alfresco.util.Ajax.JSON,
successCallback:{
fn: function(res){
appendOptiOnvalues(res)
},
},
failureCallback:{
fn: function(res){
alert("Error");
},
}
});
}
function appendOptiOnvalues(result)
{
$(".projectDescription").text(result.json.description);
$(".projectName").text(result.json.title);
$(".projectId").text(result.json.shortName);
}
11-27-2017 03:50 AM
Can you add error details which you have on browser?
Explore our Alfresco products with the links below. Use labels to filter content by product module.