plupload json响应 [英] plupload json response
本文介绍了plupload json响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我似乎无法将响应作为json对象。
I can't seem to make the response a json object.
ajax函数(plupload的url参数)回应如下响应:
the ajax function (url parameter to plupload) echoes the response like this:
echo json_encode(array(
'foo' => 3434,
'error' => 'omg error',
));
exit;
在FileUploaded事件中我正在评估:
and in the FileUploaded event I'm evaluating that:
var json = eval('(' + response + ')');
console.log(json);
但我收到错误
Uncaught SyntaxError:意外的标识符
Uncaught SyntaxError: Unexpected identifier
推荐答案
尝试使用jQuery parseJSON
方法。
Try to use jQuery parseJSON
method.
var json = $.parseJSON(response);
这篇关于plupload json响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文