我正在测试jquerymobile并且我正在尝试使用POST方法创建一个登录页面,但每次按下提交按钮我都会得到GET响应,有人可以帮助我吗?
这是我的代码:
<?php
var_dump($_SERVER);
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<title></title>
<link rel="stylesheet" href="https://d10ajoocuyu32n.cloudfront.net/mobile/1.3.1/jquery.mobile-1.3.1.min.css">
<!-- Extra Codiqa features -->
<link rel="stylesheet" href="codiqa.ext.css">
<!-- jQuery and jQuery Mobile -->
<script src="https://d10ajoocuyu32n.cloudfront.net/jquery-1.9.1.min.js"></script>
<script src="https://d10ajoocuyu32n.cloudfront.net/mobile/1.3.1/jquery.mobile-1.3.1.min.js"></script>
<!-- Extra Codiqa features -->
<script src="https://d10ajoocuyu32n.cloudfront.net/codiqa.ext.js"></script>
</head>
<body>
<!-- Home -->
<div data-role="page" id="page1">
<div data-theme="a" data-role="header" data-icon="alert">
<h3>
HEADER
</h3>
</div>
<div data-role="content">
<form action="login.php" method="POST" name="formulario">
<div data-role="fieldcontain">
<label for="textinput2">
Usuario
</label>
<input name="" id="username" name="username" placeholder="" value="" type="text" data-mini="true">
</div>
<div data-role="fieldcontain">
<label for="textinput3">
Clave
</label>
<input name="" id="password" name="password" placeholder="" value="" type="password" data-mini="true">
</div>
<input type="submit" data-theme="b" data-icon="check" data-iconpos="right" value="Validar" data-mini="true">
</form>
</div>
<div data-theme="a" data-role="footer" data-position="fixed">
<h3>
FOOTER
</h3>
</div>
</div>
</body>
</html>
提交页面后,您可以找到[“REQUEST_METHOD”] =&gt; string(3)“GET”消息。
问候。
答案 0 :(得分:0)
使用以下行解决我的问题:
<form action="" method="POST" data-ajax="false">
: - )