js function to open result