change php to javascript