Thursday, 15 August 2013

how to get the encoded data by json_encode in the java script file

how to get the encoded data by json_encode in the java script file

I am encoding file data using json_encode and this is what I get when I
send the encoded data in Javascript:

This is my php code (using codeigniter to upload a file):
$file_info = $this->upload->data();
echo json_encode($file_info);
and I use the data in my javascript file:
'onUploadSuccess' : function(file, data, response) {
alert('The file was saved to: ' + data);
}
How can I use file_name or other strings as they are encoded?!
for example how can I use:
'onUploadSuccess' : function(file, data, response) {
alert('The file name is: ' + file_name);
}

No comments:

Post a Comment