<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>George</title> <link href="styles.css" rel="stylesheet" type="text/css"> <link type="text/css" href="css/flick/jquery-ui-1.8.16.custom.css" rel="stylesheet" /> <script type="text/javascript" src="js/jquery-1.6.4.min.js"></script> <script type="text/javascript" src="js/jquery-ui-1.8.16.custom.min.js"></script> <script type="text/javascript" src="js/jquery.form.js"></script> <script type="text/javascript"> $.fx.speeds._default = 1000; $(function() { $( "#dialog" ).dialog({ autoOpen: false, show: "blind", hide: "explode", buttons: { "Отправить": function() { $('#forma').ajaxsubmit({ url: 'mail.php', success: function() { $("#result").load("mail.php"); }, error: function() { alert('Error'); } }); }, "Закрыть": function() { $(this).dialog("close"); } } }); $( "#mne" ).click(function() { $( "#dialog" ).dialog( "open" ); return false; }); }); </script> </head> <body> <div id="dialog"> <form action="mail.php" method="post" id="forma"> <textarea name="txt" rows="6" style="width:100%; height:100%"></textarea> </form> <div id="result"> </div> </div> <div id="shadow"></div> <div id="wrapper"> <div id="header"> <div id="mne"> </div> </div> <div id="info"> <div id="name"> Contacts... </div> <div id="contact"> <a href="http://vk.com/egorbuhta"><img src="/img/vkontakte.png" width="60" height="60" alt="Я в Вконтакте"></a><a href="http://twitter.com/egor_buhta"><img src="img/twitter.png" width="64" height="64" alt=""></a><a href="http://gplus.to/egorbuha"><img src="img/google-plus-icon-3.png" width="64" height="64" alt=""></a> </div> </div> <div id="news"> <div id="name"> News... </div> </div> <div id="events"> <div id="name"> Twits... </div> <center> <script src="http://widgets.twimg.com/j/2/widget.js"></script> <script> new TWTR.Widget({ version: 2, type: 'profile', rpp: 4, interval: 30000, width: 225, height: 220, theme: { shell: { background: '#623192', color: '#ffffff' }, tweets: { background: '#602f91', color: '#ffffff', links: '#edf0eb' } }, features: { loop: false, live: false, hashtags: true, timestamp: true, avatars: false, behavior: 'all' } }).render().setUser('egor_buhta').start(); </script></center> </div> </div> </div> </body> </html> 

You need to submit the form by clicking the Send button in the #dialog window and get the answer in #result at first glance, everything is correct, but the browser does not agree with me = ((((

    1 answer 1

    That's because in jquery ui dialog, when creating a dialog box, divs are actually duplicated, and your handler will not work anyway. For everything to be ok, you need to hang the handler through the open event of your dialog box.

     open: function(){ alert('примерно так'); }, 

    This is when describing a dialog box.