Free Support Forum - groupdocs.com

Using results from web service


#1

Hi,


I am making ajax calls to the groupdocs viewer web service to return the javascript libraries and the inlineDocument script.

However once I get the javascript libraries and append them to the html head element, where all the other scripts are, I get an error when the following three scripts are evaluated. The first script says it cant get cssTransforms of undefined and the others say they cant get prototype of undefined




this is the ajax call I am making

$.ajax({
url: “http://localhost:2222/WebServiceProvidingViewer.asmx/GetJavaScriptLibraries”,
type: ‘POST’,
async: false,
contentType: “application/x-www-form-urlencoded”
}).done(function(data){
var scripts = $.parseHTML(data.documentElement.textContent, document, true);
$(“head”).append(scripts);
});


Any help would be appreciated.

#2

Hi John,


We are sorry to hear that you have such issue. Unfortunately I was not able to reproduce the issue. Here is the code that I use:

and the webmethod code:
[WebMethod]
public string GetJavaScriptLibraries()
{
return Viewer.CreateScriptLoadBlock().LoadJquery().LoadJqueryUi().UseHttpHandlers().ToString();
}

[WebMethod]
public string GetInlineDocumentScript()
{
string groupdocsViewerScript;
groupdocsViewerScript = Viewer.ClientCode()
.TargetElementSelector("#MainContent_test")
.FilePath(“candy.pdf”)
.EnableRightClickMenu(true)
.ShowThumbnails(true)
.OpenThumbnails(true)
.ZoomToFitWidth()
.ToString();
return groupdocsViewerScript;
}

Please try to use it and notify me with the results. If this will not help you - please share with me example of you project that I can run and test it on my side.

Thank you.