+ 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
7 Antworten
+ 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.
+ 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.
+ 1
You can achieve this via Javascript. It's called Ajax. You can't do it just with PHP and HTML
+ 1
thanks
+ 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?
+ 1
Here you have some resources to take a look at:
https://www.w3schools.com/xml/ajax_intro.asp
https://developer.mozilla.org/en-US/docs/Web/Guide/AJAX/Getting_Started
https://developer.mozilla.org/en-US/docs/Web/Guide/AJAX (the same as the previous but one step up)
http://api.jquery.com/jquery.ajax/
0
thanks Andrey. I'll ask google