Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

As i'm new to AJAX, i'm still learning a lot and have learned a lot over the past weeks. I do need some more assistance on an AJAX issue though:

I'm using the following code to display post_thumbnails in a slider which when clicked go to the specific portfolio piece:

<ul id='portfolio-list'>
     <?php query_posts('cat=16&post_type=portfolio'); ?>
        <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
            <li class="<?php foreach((get_the_category()) as $category ) { echo $category->slug . ' '; } ?>all">
                    <?php if ( has_post_thumbnail() ) { ?>
                <a id="caseStudy" href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_post_thumbnail(); ?></a>
                <?php } else { ?>
                <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><img src="<?php bloginfo('template_url'); ?>/images/post-thumb.jpg" width="141" height="73" alt="<?php the_title_attribute(); ?>" /></a>
                    <?php } ?>
            </li>
        <?php endwhile; endif ?>
        <?php wp_reset_query(); ?>
    </ul>

What i'm looking to do is to have the portfolio piece content load on the same page.

I'm using this code:

var ajax_load = "<center><img style='margin-top: 150px;' src='<?php bloginfo("template_url"); ?>/images/loader.gif' alt='Loading...' /></center>"; 

                var loadUrl = "http://localhost:8888/cnNew/?page_id=4"; 
                    $("#ourTeam").live('click', function(){
                        $("#teamLoad")
                            .html(ajax_load)
                            .load(loadUrl + " #innerTeam")
                    });

to load other items onto the page but can't seem to get this way of calling it to work with the dynamically listed content. Can someone provide some assistance on the best way to achieve what i'm looking to do or at least a direction?

Thanks!

share|improve this question
    
are you making a cross domain request? –  Atif Mohammed Ameenuddin Jan 3 '11 at 13:02
    
No, this is all in the same domain. Why was this question down ranked for no reason? It is a legitimate question. –  jetDL Jan 3 '11 at 14:38
    
Whoever voted this down please give @jetDL a reason. I see no reason it should have been voted down. –  MikeSchinkel Jan 3 '11 at 18:25
add comment

1 Answer 1

Hi @jetDL:

Rather than me solve your problem may I suggest you consider using the more WordPress standard method of AJAX?

If you have follow up questions let us know.

share|improve this answer
    
Thanks for the links! It appears WordPress needs to update their Developer Information articles on the first link since the majority of them are broken. You wouldn't happen to have any more resources that are theme specific rather than plugin specific would you? I think seeing all these articles on Ajax in plugins is creating a huge disconnect for me for some reason. –  jetDL Jan 5 '11 at 10:44
    
While i'm still interested in learning more on the proper way to use AJAX with WordPress, I have come up with the solution to my issue. If you do have anymore resources, please do post! Thank You. –  jetDL Jan 5 '11 at 12:03
    
@jetDL WordPress Codex is a wiki so anyone can update it. As for plugin vs. theme, the code needed is essentially identical. In almost all cases, plugins and themes are just two different ways to package the same code. Glad you found a solution though. But I've added another link at your request. –  MikeSchinkel Jan 6 '11 at 1:08
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.