Setting window.open inside success