Calling Worklight adapter from external app

戏子无情 提交于 2019-11-29 12:09:31

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                  
            }
        });
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!