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?
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):