Calling Worklight adapter from external app

后端 未结 2 1885
离开以前
离开以前 2020-12-19 22:33

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

2条回答
  •  隐瞒了意图╮
    2020-12-19 22:58

    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                  
                }
            });
    

提交回复
热议问题