I was wondering what the best way would be to pass a php object via AJAX.
for example
//objectClass = objectClass.php
$obj = new objectClass();
<a href="javascript:getOutput("some variable", $obj);
As the other file i.e. output.php (called through ajax in getOutput() function) needs to access objectClass.php as well, what is the best way to access $obj?
I tried to jscon_encode($obj) then decode but not working.
Thanks in advance
Honestly, it’s going to be easiest to just store the information that needs passed (in this case an object) in a session variable like @mario suggested. If you need it to be a dynamically named session variable, you could just pass the name(string) of the session variable via AJAX.