JAVASCRIPT variable PHP



  • Is there any way to link JS and PHP to the PHP variable JS

    I said,

    <script>
    $("button").on('click', function() {
      var moderate = $("#moderate option:selected").val();
      if(moderate != 'Статус') {
        location.href = "https://site.ru/admin?moderate="+ moderate;
      }
      return false;
    });
    <?php
    $moderate = КАК УКАЗАТЬ СЮДА VAR MODERATE???
    ?>
    </script>
    


  • <script>
        $("button").on('click', function() {
          var moderate = $("#moderate option:selected").val();
          if(moderate != 'Статус') {
            location.href = "https://site.ru/admin?moderate="+ moderate;
          }
          return false;
        });
        <?php
            $moderate = htmlspecialchars($_GET['moderate']);
        ?>
    </script>



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2