jquery, passing GET value

Discussion in 'Programming' started by encom, Oct 3, 2009.

  1. #1
    I have the following jquery code:
    
    function display_comments(id) {
    $('#list_comments').load('interactive_system/list_comments.php'),
    }
    
    Code (markup):
    It is triggered by:
    
    <a href="Javascript: display_comments(<?php echo $id; ?>)">Link</a>
    
    Code (markup):
    How can I pass the id into the load url?
     
    encom, Oct 3, 2009 IP
  2. ohteddy

    ohteddy Member

    Messages:
    128
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    28
    #2
    Just append the id to the url like so. I don't know what parameter you are getting the comment id
    from in your servlet, so I've just used 'comment_id'.
    
    function display_comments(id) {
    $('#list_comments').load('interactive_system/list_comments.php?comment_id=' + id),
    }
    
    Code (markup):
     
    ohteddy, Oct 4, 2009 IP