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

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

问题描述

我在这里看到了其他类似的问题,它们已经找到了解决方案,但在尝试之后,没有一个对我的案例有效.

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

提交后,我收到一条正在加载的消息,没有其他消息.

有人有什么想法吗?

这是相关代码:

头部:

<头><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><脚本>//重置类型=日期输入到文本$( 文档 ).bind( "mobileinit", function(){$.mobile.page.prototype.options.degradeInputs.date = true;});

然后是表格:

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

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

<fieldset class="ui-grid-a"><div><input value="" name="" type="hidden"><button aria-disabled="false" class="ui-btn-hidden" type="submit" data-theme=a">登录</按钮></div></div></fieldset></表单>

注意:我在操作页面上添加了一个 Echo,但它从未到达那里.

大家有什么想法吗?

谢谢

解决方案

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

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 移动表单提交不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
其他开发最新文章
热门教程
热门工具
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆