Code for Javascript/php