jQuery Mobile + php表单提交"data-ajax =" false"不工作 [英] Jquery Mobile +php form submit "data-ajax="false" not working

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

问题描述

也许这是一个愚蠢的问题,所以我不会写很多.

Maybe it's a stupid question so I will not write a lot..

我有一个index.php文件,其中包含两个Jquery Mobile页面,每个页面都有一个传递变量的形式和php_self函数,该函数将数据插入Mysql表中.每个表格旁边都有一个表格,其中包含最新插入的数据.但是仅刷新第一页表单的表,如果我使用第二页表单,则需要按浏览器的刷新按钮以查看最新数据.

I have an index.php file with two Jquery Mobile pages each has a form passing variables a function with php_self which inserts datas into Mysql tables. Each form has a table with the latest inserted datas next to it. But the first page's form's table was refreshed only, if I used the second page's form, I needed to push the browser's refresh button to see the latest datas.

建议我在表单标签中使用data-ajax ="false".这行得通,但是网站丢失了CSS格式,因为它将页面重定向到了一个奇怪的地址. 例如,原始地址为mysite.com/index.php#page2,数据为data-ajax ="false",它将为mysite.com//index.php#page2或类似名称. 我将最新稳定的Jquery Mobile与CDN一起使用. 感谢您的回答.

I was advised to use data-ajax="false" in the form tags. This worked but the sites lost the css formatting because it redirected the pages to a strange address. For example the original address is mysite.com/index.php#page2 with the data-ajax="false" it will be mysite.com//index.php#page2 or similar. I use the latest stable Jquery Mobile with CDN. Thanks for the answers.

推荐答案

感谢有用的评论,以便我在您的帮助下找到解决方案:

Thanks for the comments that were useful so I find the solution with your help:

  1. 页面中有多个具有相同ID的div.我重写了它们.
  2. 表单没有自己的ID,所以我添加了.
  3. 我在表单元素中添加了data-ajax ="false".
  4. (!!!)我从表单元素中删除了action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"
  1. There were several divs in the page with the same id. I rewrote them.
  2. The Forms had not their own ids so I added.
  3. I added data-ajax="false" to the form elements.
  4. (!!!) I Removed the action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" from the form element

因此,所有人都工作了.我觉得Jquery Mobile和Php5真的不太喜欢.

So everythig worked. I feel the Jquery Mobile and the Php5 don't like each other really.

这篇关于jQuery Mobile + php表单提交"data-ajax =" false"不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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