skip to Main Content

enter image description hereI am using get method to fetch the data from third-party API and I am appending to list its working well but when I click the link it’s reloading and it’s not redirecting the URL link

2

Answers


  1. You might want to replace the href='#' attribute with url.

    Replace the line before the comment with this line

    $("#news").append("<a href='" + url +"' id = 'url'>" + url + "</a>");
    

    Hope this works!

    Login or Signup to reply.
  2. Please put the URL in your a tag when you append it in I’d news. Seems that you put a # only instead of a exact url. That’s why it keeps refreshing the page every time you clicked it. See code below

    $("#news").append("<a href='" + url +"' id = 'url'>" + url +</a>");
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search