Json request with Javascript
- by chota
Hi, I am just beginner on java script and JSON and never had done any work in these before. My employer has just asked me to create the basic POC of these.
Scenario:
I have a REST API and when i call it, it returns back response in JSON format.
Need to To:
Create a HTML page and use javascript to call that REST API and capture JSON response and print in the same HTML page.
<script type="text/javascript">
function loadMe() {
loadJSON('http://myrestAPI');
}
function loadJSON(url) {
//Help me here to capture the response and print in html page.
}
</script>
I would appreciate your help. This might be simple, but for me i have no idea because i never have done anything similar in java script and json. I goggled but could not find anything.
Thanks,
chota