Skip to content

Instantly share code, notes, and snippets.

@franktle1
Created March 30, 2018 16:02
Show Gist options
  • Save franktle1/1f79224ad78bb3c7af2f223986deccde to your computer and use it in GitHub Desktop.
Save franktle1/1f79224ad78bb3c7af2f223986deccde to your computer and use it in GitHub Desktop.
Example Code for Search
<button id="clicker">clickme</button>
let fakeData = {};
let clik = document.getElementById('clicker');
clik.addEventListener('click', function(e){
alert('hello');
retrieveFakeData();
alert(fakeData[0].field1);
});
function retrieveFakeData(){
fetch('https://my-json-server.typicode.com/franktle1/mockservertest/results')
.then((res)=>res.json())
.then((res)=> {
alert(res[0].field1);
fakeData = res});
}
@franktle1
Copy link
Author

Working in CompanyData.ejs for front end view
Working in sendSearch within init() function. maybe add eventlistener maybe?
you can inject this script into init preferably on the top

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment