(^314) ❘ CHAPTER 11 HTML5 DRAG AND DROP
Then the
nested within the
with id name finderDragAndDropDialogueProgressMeter is
given a percentage width, which also indicates the progress.
$('div#finderDragAndDropDialogueProgressMeter div')
.css('width', progress + '%');
}
},
false
);
Next, a load event is attached to the upload object to cover what happens when 100 percent upload
progress is reached.
this.http.upload.addEventListener(
'load',
function(event)
{
$('div#finderDragAndDropDialogueProgress span')
.text(100);
$('div#finderDragAndDropDialogueProgressMeter div')
.css('width', '100%');
}
);
}
A load event is also attached to the http object, which is fi red when the server side has responded to
the upload request.
this.http.addEventListener(
'load',
function(event)
{
// This event is fired when the upload completes and
// the server-side script /file/upload.json sends back
// a response.
When the upload request is completed, the progress dialogue is closed with a call to dragAndDrop.
closeProgressDialogue().
dragAndDrop.closeProgressDialogue();
// If the server-side script sends back a JSON response,
// this is how you'd access it and do something with it.
If the server-side sends back a JSON response, it can be read and parsed from the http.
responseText property, and the application can respond to data in the JSON response
appropriately.
var json = $.parseJSON(dragAndDrop.http.responseText);
},
false
);
http://www.it-ebooks.info
given a percentage width, which also indicates the progress.
$('div#finderDragAndDropDialogueProgressMeter div')
.css('width', progress + '%');
}
},
false
);
Next, a load event is attached to the upload object to cover what happens when 100 percent upload
progress is reached.
this.http.upload.addEventListener(
'load',
function(event)
{
$('div#finderDragAndDropDialogueProgress span')
.text(100);
$('div#finderDragAndDropDialogueProgressMeter div')
.css('width', '100%');
}
);
}
A load event is also attached to the http object, which is fi red when the server side has responded to
the upload request.
this.http.addEventListener(
'load',
function(event)
{
// This event is fired when the upload completes and
// the server-side script /file/upload.json sends back
// a response.
When the upload request is completed, the progress dialogue is closed with a call to dragAndDrop.
closeProgressDialogue().
dragAndDrop.closeProgressDialogue();
// If the server-side script sends back a JSON response,
// this is how you'd access it and do something with it.
If the server-side sends back a JSON response, it can be read and parsed from the http.
responseText property, and the application can respond to data in the JSON response
appropriately.
var json = $.parseJSON(dragAndDrop.http.responseText);
},
false
);
http://www.it-ebooks.info