Ajax and extended class
-
Hi there!
I’m building a plugin where I need some ajax calls.
This is what I haveclass ClassA extends BaseClass { function ClassA() { parent::ClassA(); add_action( 'init', array( &$this, 'init' ) ); } function init() { add_action( 'wp_ajax_test', array( &$this,'test')); } function test() { ....code...... } }
And this is the jquery code
jQuery(document).ready(function($) { var data = { action: 'test', id: 3, type:'POST' }; jQuery.post(page, data, function(response) { alert('Got this from the server: ' + response); }); });
The problem is when jquery try to ejecute the method, it can’t because BaseClass doesn’t exists in that request.
So, which is the best way to do this? Is it possible?
I hope I was clear.
Thanks!!!
- The topic ‘Ajax and extended class’ is closed to new replies.