Jquery dialog error

hello
i am getting a syntax error in my code after the button comment. which is this )};. i have tried various ways to correct it and would be grateful if someone could point out the error. many thanks

// feedback form
$(document).ready(function(){
    function feedbacknew() {

    // jquery-ui confirm dialog box
    $("#form").dialog({
        autoOpen: false,
        resizable: false,
        modal: true,
        title: 'Submit a feedback request',
        width: 440,
        height: 470

        /*buttons: {
            'Remove': function () { // remove what you want to remove
                // do something here
                alert("this is a test alert!");
                $(this).dialog('close');
                $("#flex1").flexReload();
            },
            Cancel: function () {
                $(this).dialog('close');
            }
        }*/
    });
    });


    $('#submit').click(function () {
        var name = $('.uname').val();
        var data = 'uname=' + name;
        $.ajax({
            type: "POST",
            url: "feedback.php",
            data: data,
            success: function (data) {
                $('#message').html(data);
                $("#flex1").flexReload();
            },
            error:function (xhr, ajaxOptions, thrownError){
                    alert(xhr.status);
                    alert(thrownError);
                }
        });
        return false;
    });

    $("#form").dialog('open');

}

the alert dosen’t popup. no error just white screen. my original code below is working of sorts loads, displays the form and prints the callback in the div. the problem i have with it, is that on the first press to open the function feedbacknew, it is fine and works. if i then close it and reopen it, the message is still there and in firebug it makes 2 calls to feedback.php. it increase the call to feedback.php each time i open it. i have so far got up to 9 and stopped. somebody suggested that i may need to use a document ready function. thanks

// feedback form
    function feedbacknew() {
    
        // jquery-ui confirm dialog box 
        $("#form").dialog({
            autoOpen: false,
            resizable: false,
            modal: false,
            title: 'Submit a feedback request',
            width: 440,
            height: 470
    		
            /*buttons: {
                'Remove': function () { // remove what you want to remove 
                    // do something here 
                    alert("this is a test alert!");
                    $(this).dialog('close');
                    $("#flex1").flexReload();
                },
                Cancel: function () {
                    $(this).dialog('close');
                }
            }*/
        });
    
        $('#submit').click(function () {
            var name = $('.uname').val();
            var data = 'uname=' + name;
            $.ajax({
                type: "POST",
                url: "feedback.php",
                data: data,
                success: function (data) {
                    $('#message').html(data);
    				$("#flex1").flexReload();
                },
    			error:function (xhr, ajaxOptions, thrownError){
                        alert(xhr.status);
                        alert(thrownError);
                    } 
            });
            return false;
        });
    
        $("#form").dialog('open');
    }

That }); there should be just }

hi. still. getting syntax error. firebug reports it as:

/*buttons: {
            'Remove': function () { // remove what you want to remove
                // do something here
                alert("this is a test alert!");
                $(this).dialog('close');
                $("#flex1").flexReload();
            },
            Cancel: function () {
                $(this).dialog('close');
            }
        }*/
    });
    }); <- [COLOR="Red"]ERROR[/COLOR]

thanks

Last line should be });

hi baileylo. somebody suggested that in the latest code i posted, i should use .remove() instead of close. how would i code that into my latest example? many thanks

baileylo. tried your code. still errors with ‘feedbacknew is not defined’. thanks

How are you calling feedback new? And where are you calling it from?

// feedback form
$(document).ready(function(){
    function feedbacknew() {

        // jquery-ui confirm dialog box
        $("#form").dialog({
            autoOpen: false,
            resizable: false,
            modal: true,
            title: 'Submit a feedback request',
            width: 440,
            height: 470

            /*buttons: {
                'Remove': function () { // remove what you want to remove
                    // do something here
                    alert("this is a test alert!");
                    $(this).dialog('close');
                    $("#flex1").flexReload();
                },
                Cancel: function () {
                    $(this).dialog('close');
                }
            }*/
        });
    }


    $('#submit').click(function () {
        var name = $('.uname').val();
        var data = 'uname=' + name;
        $.ajax({
            type: "POST",
            url: "feedback.php",
            data: data,
            success: function (data) {
                $('#message').html(data);
                $("#flex1").flexReload();
            },
            error:function (xhr, ajaxOptions, thrownError){
                    alert(xhr.status);
                    alert(thrownError);
                }
        });
        return false;
    });

    $("#form").dialog('open');

});

I think i just made teh suggested changes but justlints just fine.

After: $(document).ready(function(){

Add a debug statement, something to teh extent of alert(“THe function should be available now”);

If you click the flexigrid before that alert popups the reason you have the issue is because the javascript is never loaded. If the alert box pops up then i’d need to see your call to the function.

If the alert never pops up make sure you’re including the javascript file.

i am calling from a onpress:feedbacknew call in flexigrid. because of the problems i was having with the original code which actually opened the dialog with the form, i was advised to include document ready function. thanks

You’ve got bigger issues if the Alert isn’t firing…there is not reason for the alert not to be shoot as soon as the page is loaded.

If the alert doesn’t pop up you got some issues somewhere.

scallio. now i get feedback new is undefined. thanks