User offline. Last seen 6 days 14 hours ago. Offline
Joined: 04/30/2008

If you use JavaScript to send the content and use ‘escape(myContent)’ function to escape the content, you will need to change it to: ‘encodeURIComponent(myContent)’

For example:

               var clfsws = new XMLHttpRequest();

      "POST", "", true);

                clfsws.onreadystatechange = function() { _this.swsStateChangeCallback(); };

                clfsws.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

                clfsws.setRequestHeader('User-Agent', 'My very very smart user agent');

                clfsws.send("licenseID=thisismylicenseid&content=" + encodeURIComponent(content) + '&paramsXML=' + encodeURIComponent('<c:params xmlns:c="" xmlns:rdf=""><c:processingDirectives c:contentType="text/txt" c:outputFormat="text/gnosis" c:discardMetadata=";"></c:processingDirectives><c:userDirectives c:allowDistribution="true" c:allowSearch="true" c:externalID="calaisbridge" c:submitter="calaisbridge"></c:userDirectives><c:externalMetadata c:caller="GnosisFirefox"/></c:params>'));

                                } catch (ex) {

                                                if (getShowAlert())




Trackback URL for this post:

Login or Register to post a comment.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
User offline. Last seen 1 year 8 weeks ago. Offline
Joined: 06/29/2013

I am trying to follow the JavaScript sample at The send() method seems to be failing--I think the problem lies there.

var clfsws = new XMLHttpRequest();"POST", "", true);
clfsws.onreadystatechange = function() { _this.swsStateChangeCallback(); };
clfsws.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
clfsws.setRequestHeader('User-Agent', 'My very very smart user agent');

clfsws.send("licenseID=xxxxxxxxxxxx&content="+ encodeURIComponent(content)
+ '&paramsXML='
+ encodeURIComponent(content) + '&paramsXML=' + encodeURIComponent(''));

document.write('clfsws.readyState: ');
document.write('clfsws.status: ');

In Firefox, when this code executes,
clfsws.readyState = 1
clfsws.status = 0

In Safari and the default browser of my IDE,
clfsws.readyState = 1
clfsws.status = --> An exception is thrown and caught when I try to access this value.

I'm pretty sure the licenseID I'm using is valid.


User offline. Last seen 3 years 28 weeks ago. Offline
Joined: 01/27/2011

Hi, I have written the following code to access the openCalais API through jQuery. The request works find and I can see the results in Firebug, but am unable to access the data returned. the code is as follows:

baseUrl = "";
licenseID = "abcdefg12345";
content = "went snoboarding with my friend in whistler.....blah blah blah";
paramsXml = '';

var completeReqUrl = baseUrl + "?licenseID=" + licenseID + "&content=" + content + "&paramsXML=" + encodeURIComponent(paramsXml);

var postData = "licenseID=" + licenseID + "&content=" + content + "&paramsXML=" + encodeURIComponent(paramsXml);

var req = $.ajax(
url: completeReqUrl ,
type: "GET",
dataType: "script",

success: function(data, statux, xhr)
error: function(error, status)

the success callback never fires, and neither does the error callback. any ideas?

User offline. Last seen 1 year 40 weeks ago. Offline
Joined: 10/05/2009
Hi, I'm trying to call the OpenCalais API using jQuery's Ajax plugin.

The code is similar to the below:

success:function(result) {

The data is properly encoded and I have a valid license key
but every time I try this out I receive a "Mashery" error code 
something along the lines of "ERR_569_SERVICE_NOT_FOUND" when 
debugging any calls form the page.

I have also tried the simplest way of doing this using 
"var etc = new XMLHttpRequest();" and setting up like one of 
the FAQs here explained but still receive the same problem.

Using an actual form and pressing submit works fine.

Has anyone used Ajax to call the API before? Or even has a working example? 

The above returns that error message for me.


User offline. Last seen 4 years 46 weeks ago. Offline
Joined: 09/22/2009

"" is not working, but "" is ok !