Tech Tangents:Sandbox: Difference between revisions

From Tech Tangents
Jump to navigation Jump to search
(Replaced content with "<html> <script> var param = { filename: 'File_1.jpg', format: 'json', ignorewarnings: 1 }, fileInput = $( '<input/>' ).attr( 'type', 'file' ), submitBtn = $( '<input/>' ).attr( 'type', 'button' ).attr( 'value', 'Upload' ), api = new mw.Api(); $( '#bodyContent' ).append( [ fileInput, submitBtn ] ); $( submitBtn ).on( 'click', function () { api.upload( fileInput[ 0 ], param ).done( function ( data ) { console.log( data.upload.filename + ' has sucessfull...")
Tag: Replaced
No edit summary
 
(25 intermediate revisions by the same user not shown)
Line 1: Line 1:
<html>
{{#ask: [[Doom II]]|?From Year}}
 
<script>
var param = {
filename: 'File_1.jpg',
format: 'json',
ignorewarnings: 1
},
fileInput = $( '<input/>' ).attr( 'type', 'file' ),
submitBtn = $( '<input/>' ).attr( 'type', 'button' ).attr( 'value', 'Upload' ),
api = new mw.Api();
 
$( '#bodyContent' ).append( [ fileInput, submitBtn ] );
 
$( submitBtn ).on( 'click', function () {
api.upload( fileInput[ 0 ], param ).done( function ( data ) {
console.log( data.upload.filename + ' has sucessfully uploaded.' );
} ).fail( function ( data ) {
console.log( data );
} );
} );
</script>
</html>

Latest revision as of 15:32, 12 September 2024