Hi,

  I'm pretty new to this ajax, but have been trying to get it to work
with ajax.  What I'm trying to do is pass a value to a php script from
a link and return it.

  So far, I can do that with the text of the link, but I can't seem to
get how to pass either the string, or the id value....

<script type="text/javascript">

$(document).ready(function() {
        $('#action_link a').click(function() {

                $('#action_link').ajaxStart(function() {
                        $(this).html("loading").hide();
                        $(this).html("loading").fadeIn('slow');
                });

                $.ajax({
                        type: "GET",
                        url: "e.php",
                        data: "test=" + $(this).text(),
                        success: function(data){
                                $('#action_link').html(data +" Bar Added To
Favorites").show('slow');
                        }
                });
                return false;
        });
});

</script>

<body>
<div class="letter" id="action_link">
<a href="e.php?term=2"id="2">Add Bar</a>
</div>

Reply via email to