1

The below image shows the result of console.log(data) in the following block of code, but console.log(data.result) returns undefined. At first I thought it was an array, but data[0].result and data[0] both show undefined. Also weird to me, if I put console.log(data.bitrate) or contentRange, or so on, they all return values.

Console.log

This is the code I'm using it in, fileupload is from a library here

$(function() { var maxChunkSize = .5 * 1024 * 1024; //SET CHUNK SIZE HERE (.5 mb) $('.PicturesForm').fileupload({ maxChunkSize: maxChunkSize, url: 'forms/vehicle_Pictures.cfm', //URL WHERE FILE TO BE UPLOADED error: function(jqXHR, textStatus, errorThrown) { // Called for each failed chunk upload }, success: function(data, textStatus, jqXHR) { /*This event will be called on success of upload*/ var count = parseInt($(this.form).find('[name=counter]').val()) + 1; $(this.form).find('[name=counter]').val(count); }, submit: function(e, data) { /*This event will be called on submit here i am adding variable to form*/ $(this).find('[name=fileName]').val(data.originalFiles[0].name); $(this).find('[name=numberOfChunks]').val(Math.ceil(data.originalFiles[0].size / maxChunkSize)); $(this).find('[name=counter]').val('1'); }, progress: function(e, data) { console.log(data.bitrate); console.log(data); console.log(data[0]); console.log(data[0]); console.log(data[0].result); $(this).find('[name=progressBar]').html(data); } }); }); 
4
  • 1
    See that blue [i] that appears when you expand the object? Mouse-over that. Commented Jan 29, 2019 at 16:38
  • Okay, I get that it shows that because it's evaluated when I click on it; does that mean I can evaluate it somehow and get that same value? Commented Jan 29, 2019 at 17:23
  • You need to access it when it's ready to be accessed. The progress function is certainly not going to have a result value. success, however, might. Commented Jan 29, 2019 at 17:25
  • Ah, spot on. I completely missed that. Commented Jan 29, 2019 at 17:28

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.