Title: How to execute php from button click
Last modified: August 31, 2016

---

# How to execute php from button click

 *  [willshill](https://wordpress.org/support/users/willshill/)
 * (@willshill)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/how-to-execute-php-from-button-click/)
 * Hi all
 * I have a number of max buttons on my site. How can I execute a server side php
   file (Raspberry Pi) from the click of a maxbutton without redirecting away from
   the page.
 * I have read Ajax can be used but don’t know how I would like this to a button
   click. Can anyone point me in the right direction or link me to some tutorials?
 * Much appreciated.

Viewing 1 replies (of 1 total)

 *  [Tanveer Sure](https://wordpress.org/support/users/tsure/)
 * (@tsure)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/how-to-execute-php-from-button-click/#post-7221818)
 * Do you have access to the class or id of the max button you are trying to hook
   up with the php script using AJAX?
 * One way of getting the id or class could be via Google’s dev tools by right clicking
   the button in chrome and selecting “Inspect”.
 * More information on dev tools can be found here: [https://developer.chrome.com/devtools](https://developer.chrome.com/devtools)
 * If yes, then the link below may be useful. It shows you how to implement an ajax
   call given a class of a button.
    [http://wordpress.stackexchange.com/questions/24235/how-can-i-run-ajax-on-a-button-click-event](http://wordpress.stackexchange.com/questions/24235/how-can-i-run-ajax-on-a-button-click-event)
 * Not sure if you’ve already seen this Codex page : [https://codex.wordpress.org/AJAX_in_Plugins](https://codex.wordpress.org/AJAX_in_Plugins)
 * Let me know how it works out.

Viewing 1 replies (of 1 total)

The topic ‘How to execute php from button click’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [Tanveer Sure](https://wordpress.org/support/users/tsure/)
 * Last activity: [10 years, 1 month ago](https://wordpress.org/support/topic/how-to-execute-php-from-button-click/#post-7221818)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
