[英]How to store my JSON data in Ck Editor
Here is my code and its not print or display my json data in ckeditor 这是我的代码,它不能在ckeditor中打印或显示我的json数据
function getRules(){
$.ajax({
url: "api",
type: "POST",
data: {
version:'0.1'
},
dataType: "json",
success:function(response){
console.log(response.data.recordslist.RulesDetails);
CKEDITOR.instances.txtEdit.setData(response.data.recordslist.RulesDetails);
},
error: function (xhr, ajaxOptions, thrownError) {
//swal("Error!", "Please try again", "error");
}
});
}
If Your URL is correct and you have URL by the name of api only edit success function to 如果您的URL正确并且您具有api名称的URL,则仅将成功函数编辑为
success:function(response){ $('#txtEdit').text(response); }
this show a result in array you need to extract the array. 这显示了数组中的结果,您需要提取数组。 if you don't want to extract the array.
如果您不想提取数组。 remove
去掉
dataType: "json"
it work fine. 它工作正常。 and write the data in text editor.
并在文本编辑器中写入数据。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.