Yanis Boucherit
Yanis Boucherit

Reputation: 21

Unable to reopen dialog box after closing

Here's my problem...

I have the following jQuery UI script :

    <script>
$(function() {
    $( "#dialog" ).dialog({
        autoOpen: false,
        show: "slideUp",
        hide: "slideDown",
        height: "300",
        width: "400",
        title: "Test pop-up",
        buttons: {
            "Close": function(){
                $(this).dialog("close");
                    }
                }
            }           
        );

    $( "p.diag").click(function(e) {
        var monUrl = 'test2.php'; 
        $('#dialog').load(monUrl, function(response, status) {
        $('#test_dialog').html(response);
    });
    e.preventDefault();
});

    $( "p.diag").click(function() {
    $( "#dialog" ).dialog("open");
    });

It's a pretty simple code, it opens correctly my dialog box when I click on a p.diag class, but it won't re open after I close it.

The test2.php page just print a "lol" with a echo "lol";

And here's my HTML :

<div style="height: 200px; min-height: 109px; width: auto;" class="ui-dialog-content  ui-widget-content" id="dialog">
  </div>

Thanks !

Upvotes: 1

Views: 314

Answers (1)

Tats_innit
Tats_innit

Reputation: 34107

Pleas remove e.preventDefault();

see this demo: http://jsfiddle.net/ngwJ3/

Reason: http://api.jquery.com/event.preventDefault/ : If this method is called, the default action of the event will not be triggered.

Hope this help :)

Upvotes: 1

Related Questions