revised submit and delete javascript