getting the javascript function to run