Is there a best way to separate javascript and php code. for example:
//php code
if(condition1)
{
?>
// javascript code
$card_typej = $(this).val().trim();
if(condition2)
{
$("#id1").html('<?php echo($var1); ?>');
}
else
{
$("#id1").html('<?php echo($var2); ?>');
}
<?php
}
?>
If yes then, how to separate the above code?