vick
vick

Reputation: 957

grabbing text in div with jquery

  <a class="source" href="jquery-lead.php?source=<?=$src;?>">3</a>

<script type="text/javascript">
    $("a.source").live('click', function() { 
        $("#results").load(this.href, { page: $(this).text() });
      return false;
    });
    $("a.source:first").click()
</script> 

I am able to pass $src variable to my php script, but I also want to pass whatever is in the tag. In this case "3", this is going to be a pagination..

Upvotes: 0

Views: 287

Answers (2)

Nick Craver
Nick Craver

Reputation: 630399

Updated for comments - You can do it like this:

$(function() {
  $("a.source").live('click', function() { 
    $("#results").load(this.href, { page: $(this).text() });
    return false;
  });
  $("a.source:first").click();
});

This uses .load(url, data), in your php the page variable will now be available...or whatever you want it called, just rename appropriately.

Upvotes: 2

racerror
racerror

Reputation: 1629

$(this).text();

Upvotes: 0

Related Questions