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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:52:00+00:00 2026-05-28T02:52:00+00:00

I have got the following code to show a dialog box when the image

  • 0

I have got the following code to show a dialog box when the image is clicked. Instead of running FB.ui I want to run PHP code. It’s for facebook.

<html>
<head>
    <style> img#share_button { cursor: pointer; } </style>
</head>
<body>

<div id="fb-root"></div>

<script>
window.fbAsyncInit = function() {
FB.init({
    appId  : 'xxx',
    status : true, // check login status
    cookie : true, // enable cookies to allow the server to access the session
    xfbml  : true  // parse XFBML
});
};

(function() {
    var e = document.createElement('script');
    e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
    e.async = true;
    document.getElementById('fb-root').appendChild(e);
}());
</script>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js" type="text/javascript"></script>

This is the image:

<img id = "share_button" src = "img.png">

And this is the code I need to change:

<script type="text/javascript">
$(document).ready(function(){
    $('#share_button').live('click', function(e){
        e.preventDefault();
        FB.ui({
            method: 'feed',
            name: 'TabPress1',
            link: 'http://www.hyperarts.com/',
            picture: 'http://www.hyperarts.com/',
            caption: 'I am a fan of TabPress',
            description: 'TabPress -- Gotta love it!',
            message: ''
        });
    });
});
</script>

</body>
</html>

I don’t know any JS, hope you can help me!

  • 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-28T02:52:01+00:00Added an answer on May 28, 2026 at 2:52 am

    If you don’t know any javascript, perhaps it’s best if you check out some beginner tutorials, like those at http://net.tutsplus.com/category/tutorials/javascript-ajax/?tag=basix , but in regard to your question…

    It looks like your using jQuery. The best way to do what your describing is to use AJAX, and jQuery has nice functionality for that.

    To select an element from the DOM based on it’s ID in jQuery, just do this:

    $("#TheIdOfYourImage")
    

    now, to listen for when it’s been clicked,

    $("#TheIdOfYourImage").click(function(){
       //DO SOMETHING
    }
    

    Now, for the AJAX fun. You can read the documentation at http://api.jquery.com/category/ajax/ for more technical details, but this is what it boils down to

            $("#TheIdOfYourImage").click(function(){
                $.ajax({
                  type: "POST",                                 // If you want to send information to the PHP file your calling, do you want it to be POST or GET. Just get rid of this if your not sending data to the file
                  url: "some.php",                             // The location of the PHP file your calling
                  data: "name=John&location=Boston",           // The information your passing in the variable1=value1&variable2=value2 pattern
                  success: function(result){ alert(result) }   // When you get the information, what to do with it. In this case, an alert
                });
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have got the following code from here to read an Excel file using
I have got the following very simple code: function init() { var articleTabs =
I have the following code and got myself confused: I have a query that
I've got code similar to the following... <p><label>Do you have buffet facilities?</label> <asp:RadioButtonList ID=blnBuffetMealFacilities:chk
I've got a product page. The show action has the following code: def show
I have the following code: def show @game = $site.new_game_of_type(params[:id]) @game.start end def update_game_time
I have the following code, which I got by looking at the sample on
Currently i've got the following code to show a tooltip. <Border BorderBrush=Black BorderThickness={Binding Border}
I have the following question: I got some code that gets called when an
I have got the following code: - (void)tableView:(UITableView *)tableView commitEditingStyle: (UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {

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.