SwitchUp SwitchUp Ranked Best Coding Bootcamps 2025

Need help with my Wikipedia viewer

Altcademy Team wrote on 7 February 2018

I am making the getJSON call and it never seems to get to the callback function - what am I doing wrong? I never see the text "json call was made"

$(document).ready(function(){ $( "#titleText" ).change(function() { var str = "Input handled was "+ $( this ).val(); console.log( str); var searchURL = "https://en.wikipedia.org/w/api.php?format=json&action=query&titles="+$( this ).val()+"&prop=revisions&rvprop=content&callback=?"; console.log ("Calling getjson with "+ searchURL); $.getJSON(searchURL ,function(data) { console.log("jason call was made"); }); console.log("After the json call, at the end of the event handler"); });

Hey, I created a test of your code on repl.it and it seems to be working. Did you require jQuery properly in the HTML <head> tag? you can check out the working code here https://repl.it/EH6B/0

Trusted by

Students and instructors from world-class organizations

Imperial College London
Carnegie Mellon University
City University of Hong Kong
Hack Reactor
Cisco Meraki
University of Oxford
Swift
Bazaarvoice
Waterloo
Uber
AtlanTech
Tumblr
Boston College
Bombardier Aerospace
University of St. Andrews
New York University
Minerva Schools at KGI
Merrill Lynch
Riot Games
JP Morgan
Morgan Stanley
Advanced Placement®
Google
KPMG
The University of Hong Kong
University of Toronto
SCMP
Moat
Zynga
Hello Toby
Deloitte
Goldman Sachs
Yahoo
HSBC
General Assembly
Tesla
McGill University
Microsoft

Join the upcoming Cohort #97

Enroll for January 6th, 2025