Hi,

Hope someone can help. I'm struggling with getting my syntax right for
a call back.

What's i've done is wrap my setting for the jQuery dialog plugin in a
function so I can use the same setting over and over. So that's looks
like this:

function opendays_dialog(trigger){
        //Get href from link
        var url = $(trigger).attr("href");

        //Ajax get from href link
        $.get(url, function(data){
                //Display content in dialog box
                $(data).dialog({
                        height: "auto",
                        width: "auto",
                        resizable: false,
                        draggable: false,
                        position: "center",
                        modal: true,
                        overlay: {
                                background: "#333333"
                        },
                        close: function(ev, ui) { 
$(this).dialog("destroy").remove(); }
                });

                $("div.ui-dialog-content").css({height: "auto"});
        });
}

And I'm calling it in another function like so:
function opendays_manageCoursesDialog(){

        $("a.manage_courses").click(function() {

                //Load dialog box
                opendays_dialog($(this));

                opendays_manageCourses_add();
                opendays_manageCourses_prepare();

The dialog loads, however the two additional functions you can see
above don't run. I was thinking they will needing to be passed as a
callback something like:

                opendays_dialog($(this), function(){
                        opendays_manageCourses_add();
                        opendays_manageCourses_prepare();
                });

But I'm not sure about the correct syntax to make it work.

Can anyone help?

Thanks

Reply via email to