1

I'm using jQuery Address together with WordPress (latest vers.) and while trying to call in data from single.php via ajax() I get an empty string in return using Internet Explorer. This seems to be the case for all versions of the browser. The ajax call gets a "success" response but there's nothing parsed onto the data object. The function works perfect in all other browsers (surprise...).

Ajax call -

$.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; ?>

I've tried so many settings now it seems I might have to take another approach on this. Should I perhaps use some other method?

Matt
  • 22,721
  • 17
  • 71
  • 112
Staffan Estberg
  • 6,795
  • 16
  • 71
  • 107
  • Is `url` on the same domain as the website? I assume also by implication that other browsers receive a response? – Rory McCrossan Mar 28 '12 at 09:44
  • @Rory: Yes, it's on the same domain. The other browsers display the data correctly. – Staffan Estberg Mar 28 '12 at 09:45
  • try and set the async: false - this helped me with IE on an project. If response time is low on service this should not cause a problem – Steen Mar 28 '12 at 09:50
  • @Steen: Thanks but I've already tried that setting as well, same result. What does it do really? – Staffan Estberg Mar 28 '12 at 10:20
  • makes the page wait for the request to finish. Not the standard way, as browser is unresponsive while requesting...... On specific project though, FF/crome would finish async request in 0.2 sec, IE i 5+ sec. Switching to syncr made FF/Chrome/IE work the same (and fast enough) – Steen Mar 28 '12 at 10:27
  • hmm.... just tried to run the ajax part of your code in the script console of IE. Specifying a local url (/somepage.aspx) on a site works fine. Tried 1e9, comptability, IE8,IE7 (emulated)....no problem. Can you alert(data)? – Steen Mar 28 '12 at 10:36
  • @Steen: When you say emulated IE7/IE8, do you run IE9 in compatibility mode "rendering as IE7/IE8"? Because that is an inaccurate way of IE-proofing, I always run a native install. I made an alert(data) earlier and I got an empty prompt (in Chrome for example, I can see the full inserted code). – Staffan Estberg Mar 28 '12 at 10:42
  • yep....but i'm not setting up virtual pc's because of this :-). So...my IE9 works(standard and emulating), but you are apparently using another version....may help when you google for solutions – Steen Mar 28 '12 at 11:45
  • @Steen: What I meant is you need to install real versions of IE7/8 to be able to really see how they interpret the site, emulating with IE9/10 is very unstable - http://coding.smashingmagazine.com/2011/09/02/reliable-cross-browser-testing-part-1-internet-explorer/ – Staffan Estberg Mar 28 '12 at 13:53

0 Answers0