how to call a php class function directly using ajax?

Posted by payling on Stack Overflow See other posts from Stack Overflow or by payling
Published on 2010-06-08T17:54:28Z Indexed on 2010/06/08 18:02 UTC
Read the original article Hit count: 173

Filed under:
|
|

Is it possible to call a php class function DIRECTLY using ajax?

Something like below... except ajax...

myclass::myfunction();

I've been using the jquery library to work with AJAX.

$.get('control.php', {func: funcName, arg1: arg1});

The above is similar to what I'm trying to achieve MINUS the control.php;

I'm not sure if this is even possible, but I just thought it would be nice to skip the landing page (control.php) that recieves the funcName. I have a bunch of conditional statements that sort out what class function to run based on the funcName recieved.

It seems kind of silly to do this, to have a separate page just to handle function calls.

Is there a better way?

© Stack Overflow or respective owner

Related posts about php

Related posts about jQuery