是的,你可以很容易地使用隱藏的字段和使用Ajax發送或發佈數據,你必須使用表單提交方法或ajax調用發佈數據。 https://api.jquery.com/serialize/
<!-- this your simple html form with all data that user inputs -->
<form onsubmit="javascript: return false;">
<input type="text" value="" name="username" placeholder="Username" />
<!-- You can easily pass hidden values using type="hidden" -->
<input type="hidden" name="id" value="10" />
<input type="submit" name="submit" value="Submit Form" />
</form>
<!-- Now you can post all serialized data one to another file -->
<script src="https://code.jquery.com/jquery-git.min.js"></script>
<script>
$("form").submit(function(event) {
var data = $(this).serialize();
$.ajax({
type: "POST",
url: "yourfile.php",
data: data,
success: function(response){
alert(JSON.stringify(response));
}
});
event.preventDefault();
});
</script>
請更精確。舉一些例子,你的代碼中的一些行,你執行它們時得到的結果等。 – marmeladze
做一些代碼,然後問一個具體的問題,而不是一般的問題,沒有做任何事情。 – Reflective
我做了一些代碼,但我不能前進,因爲我不知道如何在PHP var chage價值。我會在接下來的五分鐘內粘貼視頻。 @我有代碼,它太大了。其實,我不確定我應該在這裏粘貼哪部分代碼。 – SilvioCro