php - Execute wp_logout_url('/') in Javascript -


i want check javascript based on condition want log user out. how call php js? doing research find lots on info on how create logout link, trying execute inside js instead.

something like:

if(variable == 1) {    execute logout no confirmation (in php function show link "<?php echo wp_logout_url('/redirect/url/goes/here') ?>") } else {                     else here; }; 

wouldn't setting location.href trick,
url pre-rendered php?

if(  variable == 1  ) {   window.location.href = '<?php echo wp_logout_url('/redirect/url/') ?>';   } else {                     //do else here; }; 

Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -