1

我将 jQuery Address 与 WordPress(最新版本)一起使用,并且在尝试通过 ajax() 从 single.php 调用数据时,我使用 Internet Explorer 得到一个空字符串作为回报。这似乎适用于所有版本的浏览器。ajax 调用得到“成功”响应,但没有解析到数据对象上。该功能在所有其他浏览器中都能完美运行(惊喜......)。

阿贾克斯调用 -

$.ajax({
    url: url, // The var url is just a short code, not an absolute URL, e.g. "motorola"
    contentType: 'text/html; charset=utf-8',
    type: 'GET',
    dataType: 'html',
    cache: false,
    success: function(data) {
        alert("data received");
        $('#display').append(data);
    }
});

WordPress single.php -

<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php $id = get_post_thumbnail_id(get_the_ID()); ?>
<div class="navigation">
    <a class="next-image" href="#"></a>
    <a class="prev-image" href="#"></a>
</div>
<div class="slideshow">
    <ul>
    <?php get_images('large','0','0'); ?>
    </ul>
</div>
<div class="desc-left">
    <p><strong>Client:</strong> <?php the_title(); ?><br><strong>Type of work:</strong> <?php $categories = get_the_category(); $categoryList; foreach($categories as $name) { $categoryList .= $name->cat_name . ' / '; } $categoryList = substr($categoryList, 0, -3); echo $categoryList; ?></p>
</div>
<div class="desc-right"><?php the_content(); ?></div>
<?php endwhile; endif; ?>

我已经尝试了很多设置,现在看来我可能不得不采取另一种方法。我是否应该使用其他方法?

4

0 回答 0