Thanks but removingfrom test.php doesn't seem to make a difference.Code:<div id="single-home-container"></div>
Header.php
footer.php has the loop tp produce the links:Code:<script> $(document).ready(function(){ $.ajaxSetup({cache:false}); $(".locationID").click(function(){ var post_id = $(this).attr("rel"); //alert($(this).attr('rel')); $("#single-home-container").html("loading..."); $("#single-home-container").html(post_id); $("#single-home-container").load("test.php", { 'locationID': $(this).attr("rel") } ); //$.post("test.php", {"locationID": post_id}, function (txt) { // alert(txt); //}); return false; }); }); </script>
Also is the include to test.phpCode:<?php $args = array( 'post_type' => 'locations', 'order' => 'DESC' ); $loop = new WP_Query( $args ); while ( $loop->have_posts() ) : $loop->the_post(); ?> <li><a href="#" rel="<?php the_ID(); ?>" class="locationID"><?php the_title(); ?></a></li> <?php endwhile; wp_reset_query(); ?>
Test.php has this to check the valueCode:<?php include(TEMPLATEPATH."/test.php"); ?>
And the main query I wish to pass the value to:Code:<?php $the_location_id1 = $_GET['locationID']; echo '<br>Loc ID '. $the_location_id1; ?>
Which i believe is the right set up from what's been posted so far!?Code:<?php $args = array( 'post_type' => 'locations', 'posts_per_page' => 1, 'p' => $the_location_id1 , ); $loop = new WP_Query( $args ); while ( $loop->have_posts() ) : $loop->the_post(); ?> <?php the_title(); ?> <?php endwhile; wp_reset_query(); ?>
Thanks again, it really is appreciated


Reply With Quote

Bookmarks