开发者

grabbing text in div with jquery

开发者 https://www.devze.com 2022-12-28 04:30 出处:网络
<a class=\"source\" href=\"jquery-lead.php?source=<?=$s开发者_StackOverflow中文版rc;?>\">3</a>
  <a class="source" href="jquery-lead.php?source=<?=$s开发者_StackOverflow中文版rc;?>">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..


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.


$(this).text();
0

精彩评论

暂无评论...
验证码 换一张
取 消