How do i use a var in my ajax?
I'm sure this is a somewhat stupid question, but I'm trying to get this code to work:
var teamName = $(this).attr('id');
$.getJSON('json/team.json', function(data) {
$("#dialog").html('<h3>' + data.teamName['name'] + '</h3>');
});
the var sets fine (gets the id from a button), but I want to be able to use it to get the JSON data so the data retrieved depends on what button is pressed. Any ideas? It's the bit in red thats being a pain. Thanks in advance.