Changed PHP to output Json formatted data. Changed JavaScript in HTML to used Json data