0

I am very new to jquery and HTML and hence this might be a very basic question. I am querying data via jquery and displaying it in HTML as a table.

function loadUserPosts(){
    $.ajax({
        url: 'services/posts?OwnerID='+loggedInUserId,
        method: 'get',
        headers: { 'Accept': 'application/json' }, 
        success: function(data) {
            console.log("Data arrived");
            for(var index in data){
                var row = "<tr><td>"+data[index].postTitle+"</td><td>"+data[index].postID+"</td></tr>";
                $("#userTable").append(row);
            }
        }
    });
    console.log("loadUserPosts - Fired request");
}

And here is how I display in HTML/JSP.

<div class="docs-section" id="allPosts">
    <h6><b>Recent Questions</b></h6>
    <table id="userTableAll"></table>      
</div>

I simply want to convert all the posts to links that open another page with "PostID" as one of the paramaters in URI. The intention is to open another page with more information on that question.

Looking for inputs please.

Ash
  • 2,108
  • 2
  • 17
  • 22
Kanishk
  • 49
  • 7
  • possible duplicate of [How to replace plain URLs with links?](http://stackoverflow.com/questions/37684/how-to-replace-plain-urls-with-links) – lukelazarovic Sep 18 '15 at 08:29
  • Use an [anchor element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a) and set the [href property](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attr-href)? – rgajrawala Sep 18 '15 at 08:34

0 Answers0