fortnox007 Posted August 12, 2010 Share Posted August 12, 2010 Hi all, I was just wondering if it possible to execute a php-script when someone presses a button without the page to reload or is this done with javascript. So for instance a calculator. I would be more than pleased to hear and if possible even a short example. All i know is to work with a form method but as far as I know that requires the page to reload. Thx! Quote Link to comment https://forums.phpfreaks.com/topic/210589-php-script-and-buttons/ Share on other sites More sharing options...
Alex Posted August 12, 2010 Share Posted August 12, 2010 For something like a simple calculator you could use pure JavaScript. To run a PHP script like you're talking about you'll need to look into AJAX. Quote Link to comment https://forums.phpfreaks.com/topic/210589-php-script-and-buttons/#findComment-1098660 Share on other sites More sharing options...
fortnox007 Posted August 13, 2010 Author Share Posted August 13, 2010 So to be just sure of this. Its not possible with php to make a button that executes a script without refreshing the page right? I just gave the calculator as anexample because its one of those things if someone presses it it show directly the effect instead of refreshing the page. Quote Link to comment https://forums.phpfreaks.com/topic/210589-php-script-and-buttons/#findComment-1098674 Share on other sites More sharing options...
Alex Posted August 13, 2010 Share Posted August 13, 2010 Yes, AJAX is most likely what you're looking for. Quote Link to comment https://forums.phpfreaks.com/topic/210589-php-script-and-buttons/#findComment-1098675 Share on other sites More sharing options...
fortnox007 Posted August 13, 2010 Author Share Posted August 13, 2010 Sweet TY man, really appreciate it, Wanted to make a simple game ; ) Quote Link to comment https://forums.phpfreaks.com/topic/210589-php-script-and-buttons/#findComment-1098677 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.