jQuery Mobile表单提交不起作用 [英] JQuery Mobile Form Submit not working

查看:95
本文介绍了jQuery Mobile表单提交不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

提交后,我收到加载消息,没有其他内容.

有人有什么想法吗?

这是relevan代码:

在头部:

<!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> 

然后填写表格:

<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>

注意:我已经在操作页面上添加了回声,但是它永远不会到达那里.

有人有创意吗?

谢谢

解决方案

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

I've seen other similar issues here that have found solutions but after trying them, none work on my case.

I am submitting a form using JQuery Mobile.

After I submit I get a loading message and nothing else.

Does anyone have any ideas?

Here is the relevan code:

in the head:

<!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> 

Then the form:

<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>

Note: I've added an Echo on the action page but it never gets there.

Any ideas anyone please?

Thanks

解决方案

Does your "checklogin.php" file have any <div data-role="page"> tag? If you expect it to load "checklogin.php", then that php file should have some HTML that jQuery mobile recognizes. It will then pull it into your page. If you check your network response to the POST request for "checklogin.php" you will probably see your echo there, but it won't show on the page. Try it.

这篇关于jQuery Mobile表单提交不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆