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! 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. 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. 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. 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 ; ) Link to comment https://forums.phpfreaks.com/topic/210589-php-script-and-buttons/#findComment-1098677 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.