我有一個稱爲消息的變量,我想使用javascript將template.php中的消息(文本區域)的值傳遞給sendmessage.php(文本區域)。你能幫忙嗎?如何在使用javascript的php頁面之間發送數據
問候,
我有一個稱爲消息的變量,我想使用javascript將template.php中的消息(文本區域)的值傳遞給sendmessage.php(文本區域)。你能幫忙嗎?如何在使用javascript的php頁面之間發送數據
問候,
可以Ajax來挑DOM元素的值,或者您可以使用location.href與您要發送附加到URL的值。 例如:http://localhost/message/index.php?&message= $('#message')。val()
希望這會對您有所幫助!
而不是您目前使用的任何重定向,請將其修改爲Javascript重定向。嘗試改變你的鏈接,如:
<script type="text/javascript">
function newLoc() {
var messages = "something"; //set up the messages variable
window.location = "sendmessage.php?messages=" + messages;
}
</script>
<a href="#" onclick="newLoc()">Click Here</a>
首先搜索這裏...有很多類似的問題 – diEcho 2012-01-04 07:47:13