jQuery ajax имеет ошибочные и успешные обратные вызовы. Вы можете сделать что-то вроде следующего:
$('#contact').submit(function() {
// ajax
$.ajax({
type: 'POST',
url: $(this).attr('ajaxgetaccommodationsbyemail'),
error: function (request, error) {
// there was error. handle it how you want
},
success: function () {
// open your pop up window
// and do other stuff
}
});
});