【发布时间】:2014-03-19 09:43:59
【问题描述】:
我正在尝试在 WordPress 的 Thickbox 中打开一个 php 文件(包含 HTML 标记)。
到目前为止,我已经成功打开了Thickbox。 php 文件的 URL 也是正确的,但它的内容没有加载到厚框中。这是我的代码:
这是我的代码:
$('.add').click(function() {
$('html').addClass('image_spe');
num = $(this).attr('data-num');
formfield = $('.id_img[data-num="'+num+'"]').attr('name');
var id=$("#post_ID").val();
jQuery.get(dialog_url, function(){ /* here, dialog_url is the URL to the PHP file*/
var f = jQuery(window).width();
b = jQuery(window).height();
f = 920 < f ? 920 : f;
f -= 80;
l = f/2;
b -= 84;
tb_show('Add', "#TB_inline?post_id="+id+"&width=" + f + "&height=" + b + "&inlineId=my-dialog");
jQuery("#TB_window").css({'width':920, 'margin-left':-l});
});
return false;
});
PHP 代码在这里:
<?php
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>
<body>
<div id="my-dialog">
<p>TESTING... YOU SHOULD BE ABLE TO SEE THIS IN THICKBOX</p>
</div>
</body>
</html>
<?php ?>
thickbox 打开没有任何问题,并且文件的 URL 是正确的。但内容不显示。
我该怎么做?
【问题讨论】:
标签: javascript php jquery wordpress thickbox