读取引导模式弹出窗口中的Querystring参数

Read Querystring parameter inside bootstrap modal popup

本文关键字:Querystring 参数 窗口 模式 读取      更新时间:2023-09-26

我在下面的jquery代码中加载了引导模式弹出中的外部页面。我需要传递querystring参数"type",但由于某种原因,模式弹出窗口在加载时不会读取它。我该如何实现它?

 // load modal popup
    function loadPopup(type)
    {
        BootstrapDialog.show({
            title: 'Candidates',
            size: BootstrapDialog.SIZE_WIDE,
            closable: false,
            message: function(dialog) {
                var $message = $('<div></div>');
                var pageToLoad = dialog.getData('pageToLoad');
                $message.load(pageToLoad);
                return $message;
            },
            buttons: [{
                label: 'Close',
                action: function(dialogItself){
                    dialogItself.close();
                }
            }],
            data: {
                'pageToLoad': 'Candidates.aspx?type=' + type
            }
        });
    }

为了确保您的"类型"不会破坏url,您可以对其进行编码:

        data: {
            'pageToLoad': 'Candidates.aspx?type=' + encodeURIComponent(type)
        }