Wie Sie Zugang zu $.ajax-Erfolg von Variablen außerhalb Umfang zu nutzen in anderen Funktionen?

Bevor dieses posting habe ich schon durchgelesen aber ich bin mir immer noch nicht klar, wie Sie diese erreichen.
Ich erhalte eine xml-Datei und das setzen einiger Variablen, wie kann ich Zugriff auf alle Variablen, die außerhalb der ajax-Erfolg in andere Funktionen?

    $.ajax({
    type: "POST",
    url: getProductList,
    data: reqProductXML,
    dataType: "xml",
    contentType: "text/xml; charset=\"utf-8\"",
    success: function (data) {
        $(xml).find('product').each(function () {
            var productID = $(this).find('id').text();
            var productName = $(this).find('name').text();
            var productCurrency = $(this).find('currency').text();
            var productDescription = $(this).find('description');
            var sipAccess = $(this).find('sipAccess');
            var skypeAccess = $(this).find('skypeAccess');
            var localAccess = $(this).find('localAccess');
            var rechargeable = $(this).find('rechargeable').text();

           $('#urProductSelect').append("<option value='" + productID + "'>" + productName + "</option>");
        });
    }
}); //End ajax

    //I need to use the variable out here....
   $('#urProductSelect').change(function () {...});
InformationsquelleAutor alvin | 2011-10-27
Schreibe einen Kommentar