Lab: Random Concept Walk
Write a page with a text entry field and a search button. Run the query through our related searches API. Pick a random response and run that through the API. Repeat three more times, for a related searches chain that's five items long, including the original query. Log the results to the console. Hint: You may want to use javascript's Fetch method, which sends AJAX requests and returns Promises natively.
console.log(query);
let request = fetch(MS_API + "?instance=" + query)
request.then((result) => {
// parsed = parse result json
// q2 = pick a related search at random
console.log(q2);
return fetch(MS_API + "?instance=" + q2)
}).then((result)=>{
...
}).then ...