+ 1

Guys, how do you call a php function without loading another php page

I'm learning php. And I'm hoping there's a way that i can run a php function when a button is clicked without loading a new php page. Any help would be much appreciated. please help

22nd Nov 2017, 6:41 PM
Evans Teye
Evans Teye - avatar
7 odpowiedzi
+ 1
I got a bit aside from it lately. So Google will tell you things better than me. Anyway it's quite simple to do. Just few lines of code. You can use JQuery too, to make it even simpler for you. The pure javascript is quite easy in this regard too.
22nd Nov 2017, 8:21 PM
Andrey Shuhakov
Andrey Shuhakov - avatar
+ 4
you should write all of your functions in one page and in every page that you need one or more functions, includ the function's page. in this way manage your functions will be better and its very useful.
22nd Nov 2017, 8:03 PM
sepehr karimi (sk12.ir)
sepehr karimi (sk12.ir) - avatar
+ 1
You can achieve this via Javascript. It's called Ajax. You can't do it just with PHP and HTML
22nd Nov 2017, 7:38 PM
Andrey Shuhakov
Andrey Shuhakov - avatar
+ 1
thanks
22nd Nov 2017, 8:07 PM
Evans Teye
Evans Teye - avatar
+ 1
Andrey, thanks for your answer. however, could you show me how? with code. using AJAX. or should I take time to learn the whole of AJAX before I understand?
22nd Nov 2017, 8:10 PM
Evans Teye
Evans Teye - avatar
0
thanks Andrey. I'll ask google
25th Nov 2017, 6:17 AM
Evans Teye
Evans Teye - avatar