嗨,我想通过 ajax 将 javascript 数据发送到 wordpress 中的同一页面。无法获取 testajax.php 页面中的数据。它显示未定义的索引:名称。以及如何在同一个 php 页面而不是 testajax.php 上发送数据?
<script>
jQuery.ajax({
type: "POST",
url: 'http://localhost/projects/xxx/wordpress/wp-content/themes/xxx/testajax.php',
data: {name:'foo'},
success: function(data)
{
alert('success');
}
});