我想從瀏覽器發送一個變量時,使用登錄到服務器。 我不能夠做到這一點......jquery post不調用php
PHP代碼:
<?php
echo "test";
$email = $_REQUEST['email'] ;
echo $email;
?>
html頁面:
<html>
<head>
<title>Demo</title>
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
<script>
alert("test");
$.post("receiver.php", { email: "John", message: "2pm" })s;
</script>
</body>
</html>
能否請你讓我知道我錯過了什麼。看起來我缺少一些非常基本的東西.. 在php文件中的回聲測試也不打印
'''。.post()'調用結束時的's'?使用您的瀏覽器控制檯來檢查JavaScript錯誤。 – tigrang 2012-08-05 00:45:26
你不會看到回顯的值,因爲你沒有做任何事情。在瀏覽器的控制檯中觀看AJAX活動,並且您應該從PHP腳本的HTTP響應中看到電子郵件。 – 2012-08-05 00:46:06