I can't seem to make the response a json object.
the ajax function (url parameter to plupload) echoes the response like this:
echo json_encode(array(
'foo' => 3434,
'error' => 'omg error',
));
exit;
and in the FileUploaded event I'm evaluating that:
var json = eval('(' + response + ')');
console.log(json);
But I get a error
Uncaught SyntaxError: Unexpected identifier
Try to use jQuery parseJSON
method.
var json = $.parseJSON(response);