Replaced php by javascript