我有一个HTML文件(index.html)包含HEAD部分和BODY部分。在BODy部分,我有一个POST操作指向一个php文件的表单。jquery mobile破坏我的POST
如果我将HEAD部分添加到jQueryMobile的CDN中,则POST停止工作。这怎么可能,以及如何避免这种情况?
所以我的头看起来像这样:
<head>
<title>My Mobile App</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1 maximum-scale=1" />
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css">
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<link rel="apple-touch-icon" href="images/icon57.png" />
<link rel="apple-touch-icon" sizes="72x72" href="images/icon72.png" />
<link rel="apple-touch-icon" sizes="114x114" href="images/icon114.png" />
<link rel="apple-touch-startup-image" href="images/icon320.png" />
<link rel="apple-touch-startup-image" sizes="768x1004" href="images/icon320.png" />
</head>
** if I comment the jquery.mobile script line the POST works **
而且随着职位的机身看起来是这样的:
<body>
<div data-role="page" id="index">
<header data-role="header" data-position="fixed">
<h1>Mobile APP</h1>
</header>
<div data-role="content">
<b>Login</b>
<form method="POST" action="prologin.php">
Name: <input type="text" name="name"><br>
Password: <input type="password" name="pass"><br>
<input type="submit" value="Login" data-inline="true" data-icon="gear">
</form>
</div>
<footer data-role="footer" data-position="fixed">
<h1>bla bla</h1>
</footer>
</div>
</body>
现在我的PHP文件prologin.php比较复杂,但对于调试目的,我减少到:
<?php
echo 'name='.$_POST['name'].' and pass='.$_POST['pass'];
?>
所以,当我使用jQuery.mobile脚本,点击结果th Ë登录按钮是一个未定义的页面,如果我查看页面源代码...它是空的,我的意思是它看起来像:
name= and pass=
,因此没有被张贴 如果我评论与jQuery.mobile脚本行,结果表明它应该,我的意思是:
name=myusername and pass=mypassword
(当然名为myUsername,输入mypassword是在输入框中我输入值) 我在做什么错?
相同的页面和代码在另一台服务器上工作得很好。但现在它不再工作了。什么可能是错的?原来的主机也是CENTOS系统,主要是相同的配置。在工作服务器上,我有PHP版本5.3.3,并在这一个(不工作)我有PHP版本5.1.6 如何使用jQuery的手机影响HTML POST的方式,它会停止工作?
我的意思是,我该如何解决它?
我会尝试更新我的PHP,但在此服务器上有其他应用程序依赖于此版本,我会避免更新。
谢谢。我不知道这个。它解决了我的问题。虽然这个问题只发生在一台服务器上,而不是另一台服务器上,这是很奇怪的。 – user1137313
只是一个笔记......再次莫名其妙......现在它在FORM中没有data-ajax =“false”。我认为我的php语法中存在current_date的问题。我的意思是我没有使用date(),而是相同函数的更新版本。我不明白这一点:(这是莫名其妙的,因为它不适用于简单的PHP,只回应POST。 – user1137313