Web Development with jQuery®

(Elliott) #1

(^190) ❘ CHAPTER 7 AJAX
function()
{
$.getJSON(
'Example 7-2/' + this.value + '.json',
function(json)
{
// Swap out the flag image
$('div#addressCountryWrapper img').attr({
alt : json.name,
src : 'flags/' + json.iso2.toLowerCase() + '.png'
});
// Remove all of the options
$('select#addressState').empty();
// Set the states...
$.each(
json.states,
function(id, state)
{
$('select#addressState').append(
$('

Free download pdf