Search code examples
jqueryajaxsimplemodal

A simple modal is not working in Firefox 3 and Internet Explorer 7


I am using the simple modal and Ajax. When I try to read the content from Ajax it works fine in Chrome. There is a problem in Internet Explorer 7 and Firefox 3.

What am I doing wrong?

My code:

print("code sample");

$(document).ready(function () {
    $('#confirma, #confirmDialog a.confirm').click(function (e) {
        e.preventDefault();

        // Example of calling the confirm function.
        // You must use a callback function to perform the "yes" action
        alert("OK");
        confirm("Hello");
    });
});

function confirm(message) {
    $('#confirm').modal({
        close: false,
        position: ["8%",],
        overlayId: 'confirmModalOverlay',
        containerId: 'confirmModalContainer',
        onShow: function (dialog) {
            dialog.data.find('.message').append(message);
            // If the user clicks "yes"
            dialog.data.find('.yes').click(function () {
                // Close the dialog
                $.modal.close();
                $.get("My.php", function (data) {
                    $('#resp').modal({
                        close: false,
                        position: ["8%",],
                        overlayId: 'confirmRespOverlay',
                        containerId: 'confirmRespContainer',
                        onShow: function (second) {
                            var test = "hello";
                            second.data.find('.info').append(data);
                            second.data.find('.yes').click(function () {
                                alert("Double OK");
                            });
                        }//onShow
                    }); //Resp
                });
            });//Click
        }// Onshow
    });//Modal
} //Confirm

I am able to read the data in file my.php, but all the content is hidden when it is showing modal in Internet Explorer 7 and Firefox 3. Chrome shows the Ajax data correctly.


Solution

  • It may work if you change

    second.data.find('.info').append(data);
    

    to

    second.data.find('.info').append(data).show();