I have the following code in JS:
$('#external-apply-job a').click(function(e) {
var button = $(this);
var url = $(this).data("system-url");
loadPreloader();
$.ajax({
url: url,
type: 'GET',
async: false,
data: {mode: 'json'},
dataType: 'json',
})
.done(function(data) {
if (data.type !== 'danger')
{ $(button).html(data.message); $(button).addClass('clicked'); $(button).trigger('click');}
})
.always(function() {
unloadPreloader();
});
});
And this is the link :
<a target="_blank" href="generated url" title="some name">Sistem</a>
I know that using
$.ajax({
url: url,
type: 'GET',
async: false,
data: {mode: 'json'},
dataType: 'json',
})
the click should be trusted event, but what is wrong is this code PS: If I use target="_self" all is ok but I need to open a new window. THX.