I am new to jquery (and all programming), so I am trying to start simple by making one request and then putting that request on the screen.
Nothing happens when I view this file in my browser. I am expecting it to put the name on my screen. That’s all I want to do, ask a question and put the answer on my screen. I am probably doing this the complete wrong way, so I am open to all suggestions!
<!DOCTYPE html>
<html>
<head>
<script type="application/javascript" src="jquery.js"></script>
<script>
$.getJSON('http://openapi.etsy.com/v2/teams/8787?method=GET&api_key=appkey&fields=name',function (data) {
$('#TeamName').html(data.results[0].name);
})
</script>
</head>
<body>
<div id="TeamName"></div>
</body>
</html>
I am using my appkey where it says appkey, i just didn’t know if i should post it here.
The server must return data in JSON format. Does it?
Also, print out the ‘data’ in your function to see if it’s what you expect:
Take a look at this example:
http://www.jquery4u.com/json/ajaxjquery-getjson-simple/#.UCPgHqOPZnQ