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

  • Home
  • SEARCH
  • 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 9116549
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T04:42:05+00:00 2026-06-17T04:42:05+00:00

I have very limited knowledge with scripts so I hope you guys can help

  • 0

I have very limited knowledge with scripts so I hope you guys can help me with a simple solution to a small problem that I have…

I’m using the following jquery function to refresh a div with new content when a link is clicked

<script> 
$(function() {       
$("#myButton").click(function() {
$("#loaddiv").fadeOut('slow').load("reload.php").fadeIn("slow");
});
});
</script>

My problem is, I need to send 2 variables to the reload.php page to use in a mysql query (I have no idea how to accomplish that), also I need to make multiple links work with this function, at the moment I have multiples links with the same id and only the first link works so I guess I must associate different ids to the function in order for this to work, how can I do that?

here’s the page where i’m using this: http://www.emulegion.info/teste/games/game.php

  • 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-17T04:42:06+00:00Added an answer on June 17, 2026 at 4:42 am

    You may want to use document ready instead of function on your first line as this will make sure the code is not executed until the full page (and all elements) have loaded.

    You can then use the callback functions of the fade and load to perform actions in a timely manner.

    additional variables you can add after the .php, these can then be read in your reload.php file as $var1 = $_GET[‘var1’];
    Do make sure to sanitize these though for security.

    <script type="text/javascript">
    
    // execute when document is ready
    $(document).ready(function() {
    
      // add click handler to your button
      $("#myButton").click(function() {
    
        // fade div out
        $("#loaddiv").fadeOut('slow',function(){
    
          // load new content
          $("#loaddiv").load("reload.php?var1=foo&var2=bar",function(){
    
            // content has finished loading, fade div in.
            $("#loaddiv").fadeIn('slow');
    
          }); // end load content
    
        });  // end fade div out
    
      }); // end add click to button
    
    }); // end document ready
    
    </script>
    

    For different variables you could add a HTML5 style variable to your button.

    <input type="button" id="myButton" data-var1="foo" data-var2="bar" />
    

    You can retrieve this when the button is clicked:

    // add click handler to your button
      $("#myButton").click(function() {
    
      // get vars to use
      var var1 = $(this).data('var1');
      var var2 = $(this).data('var2');
    
      ... 
    
      load("reload.php?var1="+var1+"&var2="+var2
    

    if you have multiple buttons/links I would use class instead of id “myButton”. that way you can apply the function to all buttons with the above script. Just replace “#myButton” for “.myButton”

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

Sidebar

Related Questions

i have very serious problem if any tech expert can help...thank you in advance..
I have very limited knowledge of using C Builder, could you give me an
I have very limited knowledge of C#. My goal is to provide a C++
I'm very new to this and have limited knowledge (all self taught over the
I have very limited coding knowledge of OpenGL/Glut. I'm supposed to build house and
I have a questions here about MySQL replication. I have a very limited knowledge
I'm unfamiliar with asyncore , and have very limited knowledge of asynchronous programming except
I'm rarely using java, so my knowledge of modern ecosystem is very limited :(.
I recently pickup Java so I have very limited knowledge, but I would like
I have a very limited knowledge on AS400 and RPG. But we have a

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.