I want to call the php function by html button or javascript code. for example if I click a button, a php function should display or do some function. I know ajax is the only way to do this, but I could not understand the ajax code for simply call the function, so please anyone give a simple example ajax code to control the php function by html button. and please do not give any code with jquery or any other library, because I not yet learn any libraries for php or javascript.
Asked
Active
Viewed 25 times
1
-
Welcome to Stack Overflow! Visit the [help], take the [tour] to see what and [ask]. Please first ***>>>[Search for related topics on SO](https://www.google.com/search?q=javascript+simple+ajax+php+site%3Astackoverflow.com)<<<*** and if you get stuck, post a [mcve] of your attempt, noting input and expected output using the [`[<>]`](https://meta.stackoverflow.com/questions/358992/ive-been-told-to-create-a-runnable-example-with-stack-snippets-how-do-i-do) snippet editor. – mplungjan Jan 25 '22 at 10:52
-
https://stackoverflow.com/questions/66589676/passing-data-to-php-script-with-ajax-and-vanilla-javascript – mplungjan Jan 25 '22 at 10:54