i have a script that i use to load some content:
<script>
$(".link_image").click(ajax_request);
function ajax_request() {
$('#placeholder').load("../test.php?id=1234556");
}
</script>
this will load test.php into my div. but what if i want to load a function that is inside test.php:
get_title();
any ideas?
thanks
You cannot call php functions from javascript as the PHP processing happens before the javascript is outputted to the page. (Basically the PHP script is no longer running when the client sees the page)
What you can do is get the output of that function using AJAX, and then use javascript to put the result wherever you want. Ask if you have any further questions.
EDIT: To be more specific, you can create a php file that essentially does
and load that to get the output of get_title().