Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8491453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T22:25:44+00:00 2026-06-10T22:25:44+00:00

// Calling the video function with JSON $.getJSON(videos.php, function(data){ // first check if there

  • 0
// Calling the video function with JSON

$.getJSON("videos.php", function(data){
// first check if there is a member available to display,
//if not then show error message
    if(data == '') { 
        $('#tabs-4').html("<div class='errorMember'>Sorry, there is currently no member available videos</div>");
    } 
    // if there is a member, then loop through each data available
    else {
          $.each(data, function(i,name){
            content = '<div class="left"><img src="' + name.pic + '"/>';
            content += '<p>' + name.name + '</p>';
            content += '<a href="' + name.link + '" target="_blank">Video link</a>';
            content += '</div><br/><hr>';
            $("#tabs-4").html(content);
        });
    }
});​

The problem is that it only gives me one result instead of list of results from the array but if I appendTo(content) .. it adds the full list of results under the current which is not what I want because I need to refresh that content with updated data.

Any ideas to what I’m doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T22:25:46+00:00Added an answer on June 10, 2026 at 10:25 pm

    Empty the element before filling it:

    $('#tabs-4').empty();
    $.each(data, function(i,name){
      var content =
        '<div class="left"><img src="' + name.pic + '"/>' +
        '<p>' + name.name + '</p>' +
        '<a href="' + name.link + '" target="_blank">Video link</a>' +
        '</div><br/><hr>';
      $("#tabs-4").append(content);
    });
    

    Or put all the elements in the string before putting it in the element:

    var content = '';
    $.each(data, function(i,name){
      content +=
        '<div class="left"><img src="' + name.pic + '"/>' +
        '<p>' + name.name + '</p>' +
        '<a href="' + name.link + '" target="_blank">Video link</a>' +
        '</div><br/><hr>';
    });
    $("#tabs-4").html(content);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Calling the WriteObject Method from a background thread is not possible! Is there a
I am able to encode video frames using libavcodec, by calling avcodec_encode_video function. How
The function purpose is to validate the URLs of a YouTube video and check
How to detect if a youtube video is not playable? I am aware there
I would like my video t0 start full screen, I'm calling the following method
Calling image = Image.open(data) image.thumbnail((36,36), Image.NEAREST) will maintain the aspect ratio. But I need
I wrote a jquery function . um calling to a coldfusion query to dynamically
I have this function: function onPlayerStateChange(event) { if (event.data == 0){ alert(event.target.parentNode); } });
In my application, we need to display the Video frame receives from server to
According to the NetStream API , Flash can play LOCAL RAW video by calling

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.