A) I have a first function which works very well :
if(onlyUs == '1' && idUser == '0'){
obj.after(jQuery('<div />').css({'clear':'both'}).addClass('kklike-msg').text('Only registered users can vote.'));
setTimeout(function(){
jQuery('.kklike-msg').fadeOut('normal');
},3000);
return false;
}
B) So I thought I could do the following thing :
if(idUser == '0'){
if(action == 'like'){
var ajaxAction = 'add_like';
}else{
var ajaxAction = 'remove_like';
}
}else{
if(action == 'like'){
var ajaxAction = 'add_like';
window.open('http://mywebsite.com/like')
}else{
var ajaxAction = 'remove_like';
window.open('http://mywebsite.com/remove')
}
}
C) Knowing that the original function is simply (works well):
if(action == 'like'){
var ajaxAction = 'add_like';
}else{
var ajaxAction = 'remove_like';
}
But B) is not working. In both condition (Login or not), the new window is going to open. Do you have a solution ?