aralejs/upload

Success response JSON is not work

Closed this issue · 4 comments

JS:

var FBUpload = new Uploader({
    trigger: '#FBUpload',
    name: 'file',
    accept: 'image/*',
    action: '/index.php?m=index&c=bingfa&a=upload',
}).success(function(r) {
    console.log('r is: ' + r);
    console.log('code is: ' + r['code']);
});

Console:

r is: {"code":1,"msg":null,"response":{"name":"\u4ea7\u54c1\u8fd0\u8425.jpg","
image":"2\/2013\/08\/13\/34b88948e2192.jpg"},"ts":1376357267}

code is: undefined

@billwing You need to parse the response yourself.

r = $.parseJSON(r)

OK,THS 👍
And why that?

@billwing 因为如果是 IE6-8 的话,是用 iframe 方式提交的,response Content-Type 应该是 text/html.

哦,我是在 Firefox 22.0 下测试的..