Wikipedia Viewer

In this example below you will see how to do a Wikipedia Viewer with some HTML / CSS and Javascript

Thumbnail
This awesome code was written by shusil123, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright shusil123 ©
  • HTML
  • CSS
  • JavaScript
    <div class="container">
	<form action="submit()">
		<input type="text" placeholder="Type to Search"/>
		<button type="submit">Search</button>
	</form>
</div>

/*Downloaded from https://www.codeseek.co/shusil123/wikipedia-viewer-RoZjLe */
    .container
	padding-top: 50px


/*Downloaded from https://www.codeseek.co/shusil123/wikipedia-viewer-RoZjLe */
    $(document).ready(function(){
	function submit() {
		// Using XMLHttpRequest
		xhr.setRequestHeader( 'Api-User-Agent', 'Example/1.0' );

		// Using jQuery
		$.ajax( {
			url: remoteUrlWithOrigin,
			data: queryData,
			dataType: 'json',
			type: 'POST',
			headers: { 'Api-User-Agent': 'Example/1.0' },
			success: function(data) {
				// do something with data
			}
		} );

		// Using mw.Api, specify it when creating the mw.Api object
		var api = new mw.Api( {
			ajax: {
				headers: { 'Api-User-Agent': 'Example/1.0' }
			}
		} );
	}
});

Comments