Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to run php code when click action occur on link

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 778
    Comment on it

    Hello Reader's, If you want to run PHP code when user click any selected anchor tag then you can use the Jquery for this. Lets see how you can run this code.

    First you have to write the onlclick action on the anchor tag like this:-

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

    Now call this function in the script and code will go like this:-

    <script type="text/javascript">
    function RunningPHP() {
        $.get("yournextpage.php");
        return false;
    }
    </script>
    

    Now onlick action will run the Jquery code in background. In this background process you can hit your PHP code which is in another page, like yournextpage.php. And don't forget to call the Jquery code in the head section by :-

    <script type="text/javascript" src="jquery.min.js"></script>
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: