在各种浏览器中兼容jquery代码

I have a simply code:

<?php
  if( isset($_POST['cnt']) ) {
    $_SESSION['counter'] += 1;
  }
  echo $_SESSION['counter'];
  echo '<button id="b1">Count</button>';
?>

<script>
    $("#b1").click(function(){
      $.post("index.php", { cnt: 1 });
      location.reload();
    });
</script>

The script without problems counts clicks on Chrome or Edge, but it completely doesn't work on FF and IE. Where could be the problem ?

查看全部
du521521521
du521521521
2015/12/26 18:13
  • php
  • compatibility
  • javascript
  • jquery
  • 点赞
  • 收藏
  • 回答
    私信
满意答案
查看全部

1个回复