jQM Template

HTML

<link rel="stylesheet" href="http://jeromeetienne.github.com/jquery-mobile-960/css/jquery-mobile-fluid960.css">
<script src="http://timeago.yarp.com/jquery.timeago.js"></script>
<script src="http://imakewebthings.github.com/jquery-waypoints/waypoints.min.js"></script>
<!DOCTYPE html>
<html>
    <head>
        <title>jQM Complex Demo</title>
        <meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
        <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; minimum-scale=1.0; user-scalable=no; target-densityDpi=device-dpi"/>
        <link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" />
        <!--<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>-->
        <script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>    
    </head>
    <body>
        <div data-role="page" id="index">
            <div data-theme="b" data-role="header">
                <h1>Index page</h1>
            </div>
            
            <div data-role="content">
                <div class="ui-block-b">
                    <a href="#popupDialog" data-rel="popup" data-position-to="window" data-role="button" data-inline="true" data-transition="pop">Feedback</a>
                </div>
                <div data-role="popup" id="popupDialog"  data-theme="c">
                    <div data-role="header" data-theme="a" class="ui-corner-top">
                        <h1>Feedback</h1>
                    </div>
                    <div data-role="content" data-theme="d" class="ui-corner-bottom ui-content">
                        <h3 class="ui-title">Thank you for your participation!</h3>
                        <p>Some content</p>
                        <a href="#" data-role="button" data-inline="true" data-rel="back" data-transition="flow" data-theme="b">Cancel</a>
                        <input type="button" id="feedback_send" value="Send" ...

JavaScript

// Solution 1
    
        $(document).on('click', '#feedback_send', function(){ 
            setTimeout(function(){
                $( "#popupDialog" ).popup( "close" );
            },1);
        });    
   

    $( "#popupDialog" ).on( "popupafterclose", function( event, ui ) {
        // Do something here, it requires SOlution 1 to trigger popup close
        alert('Popup closed');
        $( "#popupDialog1" ).popup( "open" );
    });