我正在尝试通过表单通过 javascript 发送数据,但是它不起作用。任何想法为什么?
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<form method="get" action="test.php">
<input id="myvar" type="hidden" name="albumid" />
<button type="submit" id="btnsubmit">Submit</button>
</form>
<script type="text/javascript">
$("#btnsubmit").click(function(){
var album = '11';
document.getElementById('myvar').value = album;
});
</script>
测试.php
<?php echo $_GET["albumid"]; ?>