jquerypost不调用php

jquerypost不调用php,php,jquery,Php,Jquery,当用户登录到服务器时,我试图从浏览器发送变量。 我无法做到这一点 php代码: <?php echo "test"; $email = $_REQUEST['email'] ; echo $email; ?> html页面: <html> <head> <title>Demo</title> <script src="http://code.jquery.com/jquery-lates

当用户登录到服务器时,我试图从浏览器发送变量。 我无法做到这一点

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>

演示
警报(“测试”);
$.post(“receiver.php”,{email:John,message:2pm}s;
你能告诉我我错过了什么吗。看来我错过了一些非常基本的东西。。
php文件中的echo测试也没有打印

您需要定义一个函数来处理php返回的任何内容(您还遇到了一个像@tigrang所说的轻微语法错误)。试试这个:

$.post("receiver.php", { email: "John", message: "2pm" }, function(data){ console.log(data);});

调用
$.post()
结束时的
s
?使用浏览器控制台检查javascript错误。您将看不到回显值,因为您没有对其执行任何操作。在浏览器控制台中观看AJAX活动,您应该可以在PHP脚本的HTTP响应中看到电子邮件。感谢您解决了这些问题