Possible Duplicate:
using jquery $.ajax to call a PHP function
I need to call a specific php function within my php file. Is there any way to point to that function with jquery ajax call instead of calling the whole URL?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Without a PHP framework, here are some ways to do it:
1 – Put the function in its own file.
2 – Put a wrapper function in its own file: all it does is #require your file, then call your desired function.
3 – Create one file that handles ajax (that’ll be the entry point). Then pass a choice of functions using GET. Something like ajax_handler.php?fn=MyFunction