Wikipedia Viewer

Developer
Size
2,333 Kb
Views
10,120

How do I make an wikipedia viewer?

What is a wikipedia viewer? How do you make a wikipedia viewer? This script and codes were developed by Jimmy Lin on 11 December 2022, Sunday.

Wikipedia Viewer Previews

Wikipedia Viewer - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Wikipedia Viewer</title> <link rel='stylesheet prefetch' href='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css'> <link rel="stylesheet" href="css/style.css">
</head>
<body> <link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet">
<div class="container text-center"> <h1> Wikipedia Viewer </h1> <h4>Free Code Camp Project</h4> <a href = "https://en.wikipedia.org/wiki/Special:Random" target="blank"> <img src= http://www.udlcenter.org/sites/udlcenter.org/files/wikipedia.png > </a> <input class="from-control" id="searchTerm"> <button id="search" type="button" class="btn btn-primary"> Submit </button> <ul id = "output"> </ul>
</div> <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Wikipedia Viewer - Script Codes CSS Codes

h1, h4 { font-family: "Lobster", Times New Roman;
}

Wikipedia Viewer - Script Codes JS Codes

$(document).ready(function(){ //When search is clicked run code $('#search').click(function(){ // Gets search input var searchTerm= $('#searchTerm').val(); //API url with searchTerm var url = "https:en.wikipedia.org/w/api.php?action=opensearch&search="+ searchTerm + "&format=json&callback=?"; $.ajax({ type:"GET", url:url, async:false, dataType: "json", success: function(data){ // get heading console.log(data[3][0]); // get description console.log(data[2][0]); // get link console.log(data[1][0]); $('#output').html(''); for (var i=0; i<data[1].length; i++){ $('#output').prepend("<li><a href= "+data[3][i]+">"+data[1][i] +"</a><p>" +data[2][i]+"</p></li>"); } $("#searchTerm").val(''); }, error: function(errorMessage){ alert("Error") } }); }); $('#searchTerm').keypress(function(e){ if(e.which==13){ $('#search').click(); } });
});
Wikipedia Viewer - Script Codes
Wikipedia Viewer - Script Codes
Home Page Home
Developer Jimmy Lin
Username odylic
Uploaded December 11, 2022
Rating 3
Size 2,333 Kb
Views 10,120
Do you need developer help for Wikipedia Viewer?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Jimmy Lin (odylic) Script Codes
Create amazing love letters with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!