KindEditor上传图片一直提示undefined

图片已经上传成功了,但是就是不在文本编辑器里显示图片,一直弹出undefined 

返回的JSON都对呀!这是官网说的返回值:

//成功时
{
        "error" : 0,
        "url" : "http://www.example.com/path/to/file.ext"
}
//失败时
{
        "error" : 1,
        "message" : "错误信息"
}

看我自己返回的JSON正确呀,奇怪了,只能去源代码了

if (data.error === 0) {	
     .............
} else {
    alert(data.message);
}

注意:"data.error === 0" 用了3个等号, 就是说我们返回的json 中的error 必须是数字;
如果我们返回的是文本"0" ; 那么就会弹出message;

所以error值必须是数字

 

posted @ 2019-11-16 21:59  苦逼的猿人  阅读(1027)  评论(0编辑  收藏  举报