﻿$(function () {
    $.ajax({
        url: "js/travel/airports.xml",
        dataType: "xml",
        success: function (xmlResponse) {
            var data = $("airport", xmlResponse).map(function () {
                return {
                    value: $("code", this).text() + ", " +
							($.trim($("name", this).text())),
                    id: $("code", this).text()
                };
            }).get();
            $("#city1").autocomplete({
                source: data,
                minLength: 0
            });
            $("#city2").autocomplete({
                source: data,
                minLength: 0
            });
        }
    });
});

