[wp-hackers] 3.3 media upload API

Andrew Ozz admin at laptoptips.ca
Thu Nov 10 21:23:06 UTC 2011


On 09/11/2011 3:52 AM, Steve Taylor wrote:
> So, I've got this JS:
>
> if ( typeof(wpUploaderInit) == 'object' ) {
> 	uploader.bind('FileUploaded', function() {
> 		alert( $( 'table.describe thead' ).attr( 'id' ) );
> 	});
> }
> ...
> Neither the 'UploadComplete' or 'FileUploaded' Plupload events seem to work.

Seems you're 'binding' the function too early. I would probably test for 
typeof(uploader) == 'object' and wait until after 
jQuery(document).ready() has finished running.

uploader.bind('UploadComplete', function() {
   alert('123');
});

in the console works as expected.


More information about the wp-hackers mailing list