[php] How to call a PHP function on the click of a button

You can write like this in JavaScript or jQuery Ajax and call the file

_x000D_
_x000D_
$('#btn').click(function(){_x000D_
  $.ajax({_x000D_
    url:'test.php?call=true',_x000D_
    type:'GET',_x000D_
    success:function(data){_x000D_
    body.append(data);_x000D_
    }_x000D_
  });_x000D_
})
_x000D_
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.1/jquery.min.js"></script>_x000D_
<form  method='get' >_x000D_
_x000D_
  <input type="button" id="btn" value="click">_x000D_
</form>_x000D_
_x000D_
<?php_x000D_
    if(isset($_GET['call'])){_x000D_
_x000D_
        function anyfunction(){_x000D_
            echo "added";_x000D_
_x000D_
            // Your funtion code_x000D_
        }_x000D_
    }_x000D_
?>
_x000D_
_x000D_
_x000D_

Examples related to php

I am receiving warning in Facebook Application using PHP SDK Pass PDO prepared statement to variables Parse error: syntax error, unexpected [ Preg_match backtrack error Removing "http://" from a string How do I hide the PHP explode delimiter from submitted form results? Problems with installation of Google App Engine SDK for php in OS X Laravel 4 with Sentry 2 add user to a group on Registration php & mysql query not echoing in html with tags? How do I show a message in the foreach loop?

Examples related to html

Embed ruby within URL : Middleman Blog Please help me convert this script to a simple image slider Generating a list of pages (not posts) without the index file Why there is this "clear" class before footer? Is it possible to change the content HTML5 alert messages? Getting all files in directory with ajax DevTools failed to load SourceMap: Could not load content for chrome-extension How to set width of mat-table column in angular? How to open a link in new tab using angular? ERROR Error: Uncaught (in promise), Cannot match any routes. URL Segment

Examples related to htmlbutton

How to call a PHP function on the click of a button How to create a HTML Cancel button that redirects to a URL Valid to use <a> (anchor tag) without href attribute? Can I make a <button> not submit a form? Trigger a button click with JavaScript on the Enter key in a text box