plupload decode uploadcomplete resonse

38 Views Asked by At

I am trying to decode the plupload response and pull out the value for voucher id I am being thick headed and drawing a blank Any suggestions?

FileUploaded: function(up, file, response) {
                    console.log("UPLOAD COMPLETED!!!")
                    console.log("RESPONSE ",response);
                    console.log(JSON.stringify(response));
                    console.log(jQuery.parseJSON(response));
                },

The response for example is below

{response: '{"OK":1,"info":{"name":"hedge bnackground.jpg","pa…ackground.jpg","size":"185738","voucher_id":"0"}}', status: 200, responseHeaders: 'access-control-allow-origin: *\r\ncache-control: no-…: Apache/2.4.41 (Ubuntu)\r\nvary: Accept-Encoding\r\n'}
1

There are 1 best solutions below

0
Gary On
                    FileUploaded: function(up, file, information) {
                    console.log("INFO ",information);
                    let request = information;
                    let data = JSON.parse(request.response)
                    let voucher_id = data.info.voucher_id;

                    console.log(voucher_id);