Jquery Mobile +php form submit “data-ajax=”false" not working

杀马特。学长 韩版系。学妹 提交于 2019-12-12 03:29:39

问题


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

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.

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.


回答1:


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

  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

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




回答2:


I had a similar problem with not submitting to POST array. Textarea and hidden submitted successfully. When I removed elements from the form, all variables submitted successfully. Insane.



来源:https://stackoverflow.com/questions/37448863/jquery-mobile-php-form-submit-data-ajax-false-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!