Hi everyone,

I'm trying to pass a jQuery variable to PHP script but i just can't
get it to go. Here's the code, it's a Wordpress theme in which i want
new posts loading in the same window by clicking links like this one:

<a class="tipped" href="<?php the_permalink(); ?>" title="<?php echo
$post -> ID; ?>"><?php the_title(); ?></a>

Basically i need to use title attribute and then pass its value back
to php, another file. JS:

$(document).ready(function() {
        $('.tipped').click(function() {
                var test = $(this).attr('title');
                $('#ajax').load('<?php bloginfo('template_directory'); ?>/ajax-
handler.php');
                alert('post id is ' + test);
                return false;
        });
});

And then there is "ajax-handler.php" in which i have:

<?php echo get_the_title("need to insert 'test' variable from jquery
here"); ?>

And i need to pass "test" variable from jQuery into ajax-handler.php
but anything i tried failed. Can anyone help, please?

Thank you in advance!


Reply via email to