简体   繁体   English

提交表单后刷新jQuery Mobile页面

[英]Jquery mobile page refresh after form submit

I am trying to do a page refresh after a form is submitted. 提交表单后,我试图刷新页面。 The page currently shows a list of sql rows based on a specific query. 该页面当前显示基于特定查询的sql行列表。 The form alters the status of the columns and thus some items may not meet the criteria to be displayed anymore. 该表格会更改列的状态,因此某些项目可能不再符合要显示的条件。

Currently, I have this for the form: 目前,我具有以下形式:

<form action="<?=$_SERVER['PHP_SELF']; ?>" method="post">
<input type=hidden name="potential" value="<?=$assignment['potentialid'];?>"
<fieldset>
    <div data-role="fieldcontain">

        <div class="ui-grid-b">
            <div class="ui-block-a">
                <label for="user_name" class="user_name">User:</label>
            </div>
            <div class="ui-block-b">
                <select name="user_name"><?php  users($name);?></select><br> 
            </div>
        </div> <!-- /close grid -->
        <div class="ui-grid-b">
            <div class="ui-block-a">
                <label for="quadrant" class="quadrant">Change Quadrant:</label>
            </div>
            <div class="ui-block-b">                                
                <select name="quadrant">
                    <option value="<?=$assignment['cf_648']?>" selected><?=$assignment['cf_648']?></option>
                    <option value="1-1 Create">1-1 Create</option>
                    <option value="1-2 Shape">1-2 Shape</option>
                    <option value="1-3 Assess">1-3 Assess</option>
                    <option value="1-4 Formalize">1-4 Formalize</option>
                    <option value="2-1 Determine">2-1 Determine</option>
                    <option value="2-2 Act">2-2 Act</option>
                    <option value="2-3 Serve">2-3 Serve</option>
                    <option value="2-4 Store">2-4 Store</option>
                    <option value="3-1 Feel">3-1 Feel</option>
                    <option value="3-2 Experience">3-2 Experience</option>
                    <option value="3-3 Share">3-3 Share</option>
                    <option value="3-4 Impress">3-4 Impress</option>
                    <option value="4-1 Understand">4-1 Understand</option>
                    <option value="4-2 Prioritize">4-2 Prioritize</option>
                    <option value="4-3 Complete">4-3 Complete</option>
                    <option value="4-4 Communicate">4-4 Communicate</option>
                </select>
            </div>
        </div>
    </div>
    <input type="submit" data-theme="a" name="submit" value="Submit" onClick="window.location.reload(true)" rel="external"></input>
</fieldset>

When this form is submitted, I am getting the jquery mobile "Error Loading page" and for me to actually see the changes I need to hit f5 after the form is submitted. 提交此表单后,我得到了jquery移动版“错误加载页面”,并让我实际看到提交表单后需要按f5进行的更改。 The query is correct and does take effect in the database. 该查询是正确的,并且在数据库中生效。

Any suggestions on the best way to refresh this page and that listview that it shows after the form has been submitted? 关于刷新此页面以及表单提交后显示的列表视图的最佳方法有什么建议吗?

THANKS! 谢谢!

the problem is in you should handle form submit with js code 问题是您应该使用js代码处理表单提交

<script type="text/javascript">
      function formSubmit() {
          //here you can do whatever you want
      }
</script>
<form method="post" action="javascript:formSubmit();">
    <input type="submit" data-theme="a" name="submit" />
</form>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM