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 7087221
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:38:50+00:00 2026-05-28T07:38:50+00:00

I am trying to include a Facebook like button iFrame that has PHP in

  • 0

I am trying to include a Facebook like button iFrame that has PHP in it:

 <iframe src="http://www.facebook.com/plugins/like.php?href=<?php echo $row['id']; ?>&send=false&layout=button_count" style="border: medium none; overflow: hidden; width: 115px; height: 21px;" allowtransparency="true" frameborder="0" scrolling="no"></iframe>

when the site loads this, it displays as in a list:

   <ul class="recent-list">
        <?php 
            require("inc/connect.php");
            $result = mysql_query("SELECT * FROM entries ORDER BY id DESC LIMIT 0, 20", $link);
            while($row = mysql_fetch_array($result)){   ?>

            <li id="qoute-<?php echo $row['id']; ?>"  class="quote-wrap group">
                <span>

                            <iframe src="http://www.facebook.com/plugins/like.php?href=<?php echo $row['id']; ?>&send=false&layout=button_count" style="border: medium none; overflow: hidden; width: 115px; height: 21px;" allowtransparency="true" frameborder="0" scrolling="no"></iframe>

                </span>

                <div class="quote">

                    <p>
                    <?php echo htmlentities($row['quote']); ?>
                    </p>

                </div><!-- /.quote -->
            </li>

                <?php } ?>
</ul>

But when someone click a button that fetches more list-items, the iFrame should be included…

function getQuotes(start, limit) {
                //Clear the recent list element
                //$(".recent-list").html("");
                var  recent = $(".recent-list");

               $(".recent-list li").animate({opacity: 0.1} , 800).hide(500);

                $.ajax({

                  url: "quotes.php?start=" + start + "&limit=" + limit,
                  success: function (data) {
                    data = jQuery.parseJSON(data)
                    console.log("success");
                    //Data should now be a javascript array of objects.
                    for (i = 0; i < data.length; i++) {
                      var newElem = jQuery("<li></li>").attr('id', data[i].id).addClass('quote-wrap-group');
                      newElem.append("<div class='quote'><p>" + data[i].quote + "</p></div>");
                      $(".recent-list").append(newElem);
                    }
                  }
                });
              }
                 var currentIndex = 0;  
                   $("#more").click(function () {

                     getQuotes(currentIndex, 20);
                     currentIndex += 10;
                   });

When I try to include the iframe in the js above, nothing happens. No error, nothing is returned…

quotes.php:

$start = $_GET['start'];
    $limit = $_GET['limit'];

    $sql = "SELECT * FROM entries ORDER BY id DESC LIMIT ".$start.", ".$limit;
    $result = mysql_query($sql, $link) or die("Error in query: ".mysql_error());

    $data = array(); 

    while($row = mysql_fetch_array($result)) {
        array_push($data, $row);
    }

    echo(json_encode($data));

live version. Click “Get more”. The quotes appear, but no like button.

http://kdevs.site40.net/#more

  • 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-05-28T07:38:51+00:00Added an answer on May 28, 2026 at 7:38 am

    you didn’t add the iframe tags while building the <li> it the success function

    all you did was adding (for each row):

    <li id="54" class="quote-wrap-group">
        <div class="quote">
             <p>fdggfdgdgdgfdg</p>
        </div>
    </li>
    

    a better approach will be to make the whole list items on server side, and echo it, and then append the html that you received in the success to the existing list

    for example:

    your php will look like this:

    $data = getData();//Get the data from the database here;
    foreach($data as $row): 
    ?>
       <li id="qoute-<?php echo $row["id"];?>" class="quote-wrap group">
           <span>
               <iframe src="http://www.facebook.com/plugins/like.php?href=<?php echo row["id"];?>&amp;send=false&amp;layout=button_count" style="border: medium none; overflow: hidden; width: 115px; height: 21px;" allowtransparency="true" frameborder="0" scrolling="no"></iframe> 
          </span>
          <div class="quote"><p><?php echo $row["quote"];?></p></div>
       </li>
    <?php endforeach; ?>
    

    your javascript function will be:

    function getQuotes(start, limit){
        $.ajax({
          url:"quotes.php?start=" + start + "&limit=" + limit,
          dataType: "html",
          success: function(response){
             $("ul.recent-list").append(response);
          }
       });
    }
    

    this of course trying to show the principle, and not necessarily be the exact code you need to write. You need to add the other functionality (like hiding the previous quotes etc…)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to demystify the Like button as of December 2011. http://developers.facebook.com/docs/reference/plugins/like/ Have 2 questions:
I am trying to include Facebook's Javascript SDK (the all.js file from http://connect.facebook.com/en_US/all.js )
I'm trying to include a Facebook Like button for my App Tab in a
I'm trying to include a Facebook share iframe on a site that's served using
I am trying to apply css to facebook like button. I know that it
I am trying to use the facebook API provided by Nokia Developer: http://www.developer.nokia.com/Community/Wiki/Facebook_Connect I
Trying to include ThickBox (from http://jquery.com/demo/thickbox/ ) in an ASP.NET application. Visual Studio is
I'm trying to figure out how to add a Facebook like button on a
I'm trying to use a PHP include or require like this: <div id=menu> <?php
I was trying Include extension method from http://damieng.com/blog/2010/05/21/include-for-linq-to-sql-and-maybe-other-providers , but it does not really

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.