How to Access a Web Service?

Mar 4, 2014 at 4:52 PM
I'm trying to access a web service from my JavaScript code. I tried to use the AJAX capability of jQuery but ClearScript was not able to load the jQuery library. I got the error "defaultView is not a property of undefined". It seems that jQuery is expecting to be hosted in a web page. I'm using it to allow customization of a desktop application. Is there another way to access a web service that is compatible with ClearScript?

Thanks,
Neil
Coordinator
Mar 4, 2014 at 9:39 PM
Hi Neil,

Since you have .NET at your disposal, why not use something like System.Net.WebClient?
engine.AddHostType("WebClient", typeof(WebClient));
engine.Execute(@"
    var client = new WebClient();
    var html = client.DownloadString('http://cnn.com');
");
Cheers!