ajax call to a php class but can't access the class variables
This is a bit hard to explain
I have made a checkout style plugin that gets the post and begins a payment process.
A new object is created by the plugin called say ‘$object’ and the checkout is started by calling $object->start($postid) by which the class vars are set eg $postidVar.
During the checkout process i use an AJAX call which calls a method within the $object class, which again works fine. The problem i’m having is that inside this method i can’t access any of the class variables eg $object->postidVar; to use within this method. They output in methods called before and after the ajax function is called but not during.
Is it something to do with because i’m calling the method outside from a click handler which is using the previously set add_action function to call the method in the class that it is not recognizing the previously set post variables, but the method is called from the previously created object reference eg
add_action(‘wp_ajax_update_planner’, array($filmCheckout, ‘update_planner’));
i’m at a loss, if anyone could steer me in the right direction that would be great.
- The topic ‘ajax call to a php class but can't access the class variables’ is closed to new replies.