问题
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:
- There were several divs in the page with the same id. I rewrote them.
- The Forms had not their own ids so I added.
- I added data-ajax="false" to the form elements.
- (!!!) 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