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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T04:16:14+00:00 2026-05-29T04:16:14+00:00

i want run a php code when a user click a link and change

  • 0

i want run a php code when a user click a link and change temporarily value of link with output returned by script without reloading page and redirect user to another page

for example if a users click on button :

Click Me!

a code php run for example script.php

<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript">
function doSomething() {
    $.get("script.php");
    return false;
}
</script>

<a href="#" onclick="doSomething();">Click Me!</a>

for example if output of script( $result ) is: 30

then 30 will replaces button: “Click Me!” without reloading page

so at the end after the script is executed i have temporarily instead of “Click Me!” number 30 and if is possible also add a animation gif or something of similar so as: wait wait blinking during execution of script
thanks

  • 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-29T04:16:15+00:00Added an answer on May 29, 2026 at 4:16 am

    Try this, create a class with two methods uW (user wait) uWC (user wait cancel). This class can be reused for future as well

    var Util = {
    uW:function(id) {
                $("#"+id).html("<img src='path to animation GIF' />");        
    },
    uWC:function(id,data) {
            $("#"+id).html(data) ;        
    }
    }
    

    Now your function will looks like this

    function doSomething() {
    Util.uW('clickme'); // clickme is ID of your anchor tag
    $.ajax({
     url: "script.php",
     context: document.body,
      success: function(data ){
        Util.uWC('clickme',data );
      }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to have a page run some PHP code when a user clicks
I want to run a shell script restore as postgres user from php script
I want to run a php script from the command line that is always
I want to run a particular block of PHP if the user submits a
I wrote a little PHP script below to demonstrate my question. Run the code
I am writing a pre-commit hook. I want to run php -l against all
I want to run a web application on php and mysql, using the CakePHP
I have a series of PHP scripts that I want to run in a
I have a series of PHP statements that I only want to run if
I want run a script as follows: runner: ssh 'java program &' ssh 'java

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.