好的,我尝试使用 jquery ajax 来实现相同的效果。但是现在系统总是显示第一个 id。我点击哪个edit_subscriber 图像并不重要。这就是我所做的:
jQuery代码:
jQuery(".edit_subscriber").click( function() {
jQuery('.dialog-modal').dialog({
modal: true,
open: function ()
{
jQuery.ajax({
async: false,
type: 'get',
url: nieuwsbrief.editsubscriber,
data: 'ajax=&subscriber_id=' + jQuery('.edit_subscriber').prop('id'),
success: function(data) {
jQuery('.dialog-modal').html(data);
}
});
},
close: function ()
{
},
height: 400,
width: 600,
title: 'Ajax Page'
});
return false;
});
html代码:
echo '<div class="dialog-modal" title="Basic modal dialog" style="display: none;"></div>';
编辑订阅者.php:
<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/www/wordpress/wp-config.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/www/wordpress/wp-load.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/www/wordpress/wp-includes/wp-db.php';
global $wpdb;
echo $_GET['subscriber_id'];
?>