Jquery Alert PHP变量

Is there away to alert this variable without using ajax? need guide, trying todo this in one page heres my code.

<?php
if($totalActive == 10 OR $totalActive < 10){
echo "<input id='activo' type='hidden' value='$totalActive'>";
?>
    <script type="text/javascript">
    var tom = $("#activo").val();
    alert("Your Credit Balance will expires in  "+ tom +"days 
 Please buy more credits to extend the expire date");
    window.location.href = "Outbox.php";
    </script>
<?php
}//continue php scripts

im trying to alert how many days left, does the user have before its credit balance expires, i think you cant combine php with jquery, but is there away to do this?

You can call PHP in javascript, but not javascript in PHP.

Also you don't need to do an OR, you can just check if $totalactive is less than or equal to 10 using <=.

<?php
  if($totalActive <= 10){
?>
    <script type="text/javascript">
    alert("Your Credit Balance will expires in <?php echo $totalActive; ?> days 
 Please buy more credits to extend the expire date");
    window.location.href = "Outbox.php";
    </script>
<?php
}

Another way, which could look more flexible if you want to use that variable in functions or just keep your javascript code in your .js files, would be to get the value in a hidden element such as:

<input id="expireDays" type="hidden" value="<?php echo $totalActive; ?>" />

Then you would only need to retrieve it with jQuery or javascript on document ready:

$(document).ready(function() {
   var expiredDays = $('#expireDays').val();

   alert("Your Credit Balance will expires in  "+ expiredDays +"days 
 Please buy more credits to extend the expire date");

});