JQuery UI Dialog - Ajax Update bei Erfolg $(this).dialog('close');

Probleme bei der Referenzierung $(this) aus einem der verschachtelten ajax "Erfolg" - Funktion... ich weiß, das ist ein scope Problem, aber kann nicht scheinen zu finden, eine saubere Möglichkeit um das Dialogfeld zu schließen auf ein erfolgreiches update. Vielen Dank für jede Hilfe.

$("#dialog_support_option_form").dialog({
        width: 400,
        height: 180,
        bgiframe: true,
        autoOpen: false,
        modal: true,
        buttons: {
            'Save Support Option': function(){
                $.ajax({
                    type: 'POST',
                    url: "support_options/create_support_option.php",
                    data: $(this).find('form').serialize(),
                    success: function(data){
                        $("#list_support_options").html(data);
                        $(this).dialog('close');
                    }
                });
            },
            'Cancel': function(){
                $(this).dialog('close');
            }
        },
        close: function(){
            $(this).find('input').val('');
        }
    });

InformationsquelleAutor uberdanzik | 2010-04-06

Schreibe einen Kommentar