1
$back = mysql_query("SELECT * FROM student WHERE roll_no=".$_POST['roll']) or die(mysql_error());
$backup = mysql_fetch_array($back) or die(mysql_error());
<form method='post'>
    <input type='submit' name='undo' value='Undo' 
        onsubmit="return confirm('Are you sure you want to rollback deletion of 
            <?php echo $backup['name'];?> 
            from 
            <?php echo $backup['post'];?>
            ?')"/>
</form>

如何用上述参数替换 javascript 确认与 jquery ui 对话框。

4

1 回答 1

0
<form id="submitform" method='post'> ... </form>

   $('<div></div>').appendTo('body')
                        .html("<div><span>Submit form " + document.getElementById('phpcode').innerHTML+"</span></div>")
                        .dialog({
                            modal: true, title: 'Submit form', zIndex: 100, autoOpen: true,
                            width: 'auto', resizable: false,
                            buttons: {
                                Yes: function () {
                                    $("#submitform").submit();
                                    $(this).dialog("close");
                                },
                                No: function () {
                                    $(this).dialog("close");
                                }
                            },
                            close: function (event, ui) {
                                $(this).remove();
                            }
                        });


<div id="phpcode"><?php echo $backup['name'];?> 
            from 
            <?php echo $backup['post'];?>
            ?')"/>
</div>

这应该与简单的 javascript 确认对话一样工作。

于 2013-08-12T12:14:49.310 回答