Created
March 30, 2018 16:02
-
-
Save franktle1/1f79224ad78bb3c7af2f223986deccde to your computer and use it in GitHub Desktop.
Example Code for Search
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<button id="clicker">clickme</button> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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