0

モーダル ウィンドウを開く JavaScript 関数 (href リンク) があり、その関数/ウィンドウから、約 4 つの PHP 関数を持つ PHP ページ (box.php) に送信したいと考えています。それらの 1 つは、他の 3 つの関数をチェックする「check_box」です。それを行う方法はありますか、それとも JavaScript で可能/サポートされていませんか? これは私が持っているものです:

PHP ページ:

<a href="javascript:openModal()" title="" style="padding-right: 10px;">LEAVE</a>

PHP コード:

<?php
echo $class->box->check_box() ?>

JavaScript 関数:

function openModal()
    {

        $.modal({
            content: 
                    /* This where the content of the modal window goes */

            title: 'Outside the workplace',
            width: 300,
            scrolling: false,
            actions: {
                'Close' : {
                    color: 'red',
                    click: function(win) { win.closeModal(); }
                },
                'Center' : {
                    color: 'green',
                    click: function(win) { win.centerModal(true); }
                },
                'Refresh' : {
                    color: 'blue',
                    click: function(win) { win.closeModal(); }
                },
                'Abort' : {
                    color: 'orange',
                    click: function(win) { win.closeModal(); }

                }
            },

            buttons: {
                'Close': {
                    classes:    'huge blue-gradient glossy full-width',
                    click:      function(win) { win.closeModal(); }
                                    }
                                    },


            buttonsLowPadding: true
        });
    };
4

1 に答える 1

0

挿入を行う php ページを作成します。その PHP でブラウザーからのパラメーターを解析し、挿入を実行します。次に、メッセージを出力します。JavaScript では、指定されたメッセージを表示しますDIV-- 次のようなものです (値を修正し、パラメーターを関数に渡します)。

function setToDatabase() {
    jQuery(function($) {    
        $.ajax( {           
            url : "submittosql.php?valuetosubmit=NEWVALUE",
            type : "GET",
            success : function(data) {
                document.getElementById("YOURDIV").innerHTML=data;             
            }
        });
    });
}
于 2012-12-18T19:21:42.063 に答える