I have deployed the adapter on Worklight server and there is some requirement where I am calling worklight adapter from outside as a rest serverice , it is working fine and
remove /dev/ component from the URL, it is for development ease purposes only. without it you'll get your JSON.
I had the same issue and after reading Anton's answers I set the "dataType" of the Ajax call to "text" and then edit the response to remove the /*-secure- and */ and then parsed the string to get the JSON "JSON.parse(theString)"
$.ajax({
type: 'POST',
url: ajaxURL,
async: true,
cache: true,
timeout: 5,
dataType: "text",
success: function(data){
data = data.replace("/*-secure-","");
data = data.replace("*/","");
var dataJSON = JSON.parse(data);
//Do success
},
error: function(data, statusCode){
//Do error
}
});