fixed javascript to transfer data