Popup window after ajax call


By default iOS Safari doesn’t support window.open within ajax call, window.open must be called after completion of the ajax

	type : 'POST',
	async: false, 
	url : 'https://example.com/.....',
	data : $('#form').serialize(),
	success: function (data, status, xhr) {
		success = true;
		if (status === 'success') {
			popupurl = "https://google.com/......";
	error: function (jqXhr, textStatus, errorMessage) {
		console.log('Error: ' + errorMessage);
if (success) {

What this does is when the Ajax call is success it sets the variable success to true.
The async:false propperty makes sure that the if statement is fired after the Ajax call is completed.
So the window.open is fired