Goodmorning folks!
I've been testing my JavaScript code via the Google Chrome developer console, and fixed all of the errors, except one that says,"Uncaught SyntaxError: Unexpected token :" I found similar questions on Stack Overflow, but my situation is different. In addition, usually when the console lists the error, it would have provide a link to view the error, which would be underlined in red. However, this time the console lists the error, but doesn't underline, in red, the wrong part of the code.
To me everything looks formatted correctly, and all my double colons look correctly placed. Are you able to help? Thanks in advance!
Here is my JavaScript code:
$(document).ready(function(){
//when search is clicked run code
$(search).on('Click'(function(){
//gets search input
var searchTerm= $("#searchTerm").val();
//API url with searchTerm
var url="https://en.wikipedia.org/wiki/Special:ApiSandbox#action=query&titles=Main%20Page&prop=revisions&rvprop=content&format=jsonfm";
//create an AJAX call within .on("Click") function
$.ajax({})
//We intend to do a GET call (because we are retrieving data from the server)
type: "GET"
url: url,
//code will be paused while other code waiting for this to finish
Async: false,
dataType: json,
Success: function(data){
//How will you test for success of json call function
console.log()data;
},
//Do something when its a function and do something else when it's a failure
Error: function(errorMessage){
//Console out a warning that says something like "error" alert
alert("Error");
}
}); //search
});//document ready