@ginerjmMay 30.2014 — #1 - you don't execute a php function from anywhere but INSIDE php. To be correct you should be saying "script".
2 - You can't execute php from a webpage. You can execute JS but not php. A webpage is what is on your client pc, comprised of html and perhaps js, and therefore cannot run php.
3 - This means that what you are really asking is "How to make an ajax call". I'd try google first. Many examples of it out there.
How does ajax work? An event in your webpage triggers a JS function. The event can be a click on an anchor, a button, or even a change event on an html tag. In that JS function you have some JS code that sets up the ajax call which then executes a separate process ON YOUR SERVER wherein PHP code runs to do your desired task. Once the task is complete it sends back a result that your JS code (waiting in a loop for the results) receives and interprets and posts to your webpage or does whatever your ultimate purpose is.