I found another thread on stackoverflow: window.open popup getting blocked during click event. And the top answer seems to solve the problem. But I don't know a lot of JavaScript.
Can you help rewrite the code according the answer:
1) Call window.open
just before calling $.ajax
and save window reference:
var newWindow = window.open(...);
2) On callback set location property of the saved window reference:
newWindow.location = url;
Maybe it's already in an explicit way. But I don't have any idea how to rewrite the code.