Replace Functionality Provided By PHP With JS