Hi, I have a selectbox that needs to be updated dynamically. I am using jquery to perform that using .load($url), where $url is the location of the php file to call. I am wondering if there is a way to call a specific function within that php file instead of calling the entire php file.
A:
no, you can't. but you can pass GET parameters to the URL, and use that URL as a controller. for example:
.load("/ajax_controller.php?action=whatever")
ozk
2010-08-10 15:19:03
A:
You can pass a parameter to PHP script and user switch in script to select which action needs to be done
Im0rtality
2010-08-10 15:19:38
+3
A:
You could send a GET parameter as part of the AJAX request e.g. blah.php?func=1
Then in your PHP file:
if ($_GET['func'] == 1) {
do_something();
}
else {
do_something_else();
}
Or you could use something like CodeIgniter that structures its URL's as controller/function/parameter
fire
2010-08-10 15:20:32