Hello. I’m unable to pass the second step under XHR Get Requests III in Learn Javascript: Requests. Not sure what I’m doing wrong. Thanks for the help.
Here is the code in full.
// Include data for accessing Google APIs
const apiKey = 'AIzaSyAgUw6wr3FIvZkRYf92ha-e0Rn_vwgorBg';
const projection = 'FULL';
const url: "https://www.googleapis.com/urlshortener/v1/url";
// Some page elements
const $inputField = $('#input');
const $expandButton = $('#expand');
const $shortenButton = $('#shorten');
const $responseField = $('#responseField');
// AJAX functions
function expandUrl() {
const urlToExpand = url + '?key=' + apiKey + '&shortUrl=' + $inputField.val();
}
function shortenUrl() {
}
function expand() {
$responseField.empty();
expandUrl();
return false;
}
function shorten() {
$responseField.empty();
shortenUrl();
return false;
}
// Call functions on submit
$expandButton.click(expand);
$shortenButton.click(shorten);