Jump to content

Edit History

Shabab

Shabab

26 minutes ago, EvaF said:

don't mess php and javascript code

try


jQuery('document').ready(function() {
 {if $logged}
	console.log("Logged In");
	// Do something here - in javascript
 {else}
	console.log("Not Logged In");
	// Do something here - in javascript
 {/if}
});

You need to assign {$logged} to java-script . If you are using separate java-script file then this code did not work . You need to assign {$logged} as java-script variable by using Media::addJsDef('logged', $logged); After that you can use logged as java-script variable

jQuery('document').ready(function() {
 if (logged)

{
    console.log("Logged In");
    // Do something here - in javascript
 }

else

{
    console.log("Not Logged In");
    // Do something here - in javascript

}
});

 

Shabab

Shabab

17 minutes ago, EvaF said:

don't mess php and javascript code

try


jQuery('document').ready(function() {
 {if $logged}
	console.log("Logged In");
	// Do something here - in javascript
 {else}
	console.log("Not Logged In");
	// Do something here - in javascript
 {/if}
});

You need to assign {$logged} to java-script . If you are using separate java-script file then this code did not work . You need to assign {$logged} as java-script variable by using Media::addJsDef('logged', $logged);

 

×
×
  • Create New...