例如我有一个变量
var test = "done";
如何将其发送到php?然后发布
答案 0 :(得分:0)
尝试使用此代码
<script>
var test = "done";
document.getElementById('sample').value = test;
</script>
<form method = "post">
<input type="hidden" id="sample" name="stext">
<input type="submit" name="submit" value="submit">
</form>
<?php
echo $_POST['stext'];
?>