这是我的代码,它不会在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");
}
});
}
答案 0 :(得分:0)
如果您的URL正确,并且您具有 api 名称的URL,则仅将成功功能编辑为
success:function(response){ $('#txtEdit').text(response); }
这显示了数组中需要提取数组的结果。 如果您不想提取数组。删除
dataType: "json"
工作正常。并在文本编辑器中写入数据。