JQuery Mobile表单提交无效

Sat*_*000 5 jquery jquery-mobile

我在这里看到其他类似的问题已经找到了解决方案,但在尝试之后,我的案例都无法解决.

我正在使用JQuery Mobile提交表单.

我提交后,我得到一个加载消息,没有别的.

有没有人有任何想法?

这是相关代码:

在脑袋里:

<!DOCTYPE html> 
<html> 
    <head> 
    <title>Page Title</title> 
    <link rel="stylesheet"  href="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.css" />
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.5.2.min.js"></script>
    <script type="text/javascript" src="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.js"></script>


    <script>
  //reset type=date inputs to text
  $( document ).bind( "mobileinit", function(){
    $.mobile.page.prototype.options.degradeInputs.date = true;
  });   
</script>


</head> 
Run Code Online (Sandbox Code Playgroud)

然后形式:

<form name="form1" method="post" rel="external" action="checklogin.php">


<div class="ui-field-contain ui-body ui-br" data-role="fieldcontain">
 <label class="ui-input-text" for="name">Username:</label>
<input name="myusername" id="myusername" value="" type="text">
</div>

<div class="ui-field-contain ui-body ui-br" data-role="fieldcontain">
 <label class="ui-input-text" for="name">Username:</label>
<input name="mypassword" id="mypassword" value="" type="text">
</div>

<fieldset class="ui-grid-a">
<div><input value="" name="" type="hidden"><button aria-disabled="false" class="ui-btn-hidden" type="submit" data-theme="a">Login</button></div></div>
</fieldset>



</form>
Run Code Online (Sandbox Code Playgroud)

注意:我在操作页面上添加了一个Echo但它永远不会到达那里.

有什么想法吗?

谢谢

小智 16

jquery mobile使用ajax传递表单,只需关闭它就可以了

<form action="form1" method="post" data-ajax="false">


Jay*_*Jay 5

您的"checklogin.php"文件是否有任何<div data-role="page">标记?如果你希望它加载"checklogin.php",那么那个php文件应该有一些jQuery mobile识别的HTML.然后它会将其拉入您的页面.如果您检查网络对"checklogin.php"的POST请求的响应,您可能会在那里看到您的回显,但它不会显示在页面上.试试吧.