PHP - Class AJOX Conversion