我有一个 HTML 表单
<form method="POST" action="" name="myform" id="myform">
<input type="text" name="email" id="email" />
<input type="supmit" name="submit" id="submit" value="submit" />
</form>
还有一段jQuery代码:
$(document).ready(function(){
var validator = $("#myform").validate({
ignore: ".ignore",
rules: {...},
messages: {...},
submitHandler: function(form) {
$.post('usr.php?resetpw', $(this).serialize(), function (data, textStatus) {
form.submit();
alert(data.inf);
},'json');
},
});
还有没有得到 $_POST-variables ( isset($_POST['email'])
= false
)的 PHP 代码 usr.php
if(isset($_GET['resetpw'])) {
$loggingData = array(
'inf' => utf8_encode("Your email address is: ".$_POST['email']),
'errorEmail' => '',
'mailExists' => '',
'success' => '',
);
}
echo json_encode($loggingData);
将变量发布到 PHP 的正确代码是什么?
谢谢