Making the AJAX Request
Explore how to integrate AJAX requests within a RamdaJS-based Wikipedia search app. Understand mapping URLs, fetching JSON responses, and preparing the data for UI updates in a functional programming style.
We'll cover the following...
We'll cover the following...
We left off here
And had working URL functionality.
Next step is mapping that URL to an AJAX request and collecting the JSON response.
Rename makeUrlFromInput to searchAndRenderResults and edit it to look like this.
We’ve simply renamed it and added a function that fetches the URL and logs the JSON response.
Don’t forget to change your event listener too!
Here’s our result
Looking good so far! We’re making the AJAX request and properly parsing/logging the response.
Next step is hooking it up with our UI!