【问题标题】:How refresh part of page after submit?提交后如何刷新部分页面?
【发布时间】:2018-10-06 04:39:06
【问题描述】:

我为创建用户开发功能,当我创建用户时所有页面刷新,但我只想自动刷新表格,只刷新表格而不是所有页面,如何纠正我的问题?

function JSalert() {
  swal({
    title: "opération effectuée avec succès",
    text: "",
    icon: "success",
    confirmButtonColor: "#C13232"
  });
  $(document).ready(function() {
    $("button").click(function() {
      location.reload(true);
    });
  });
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="modal-body" ng-style="{'height': '500px','width':'643px'}">
  <form name="myForm1" id="myForm">
    <div class="form-group">
      <label name="refe" class="col-form-label">Email:</label><span style="color: red;">*</span>
      <input type="text" class="form-control" name="refee" ng-model="registration.Email" required>
    </div>
    <div class="form-group">
      <label id="tire7" class="col-form-label">Adress:</label><span style="color: red">*</span>
      <input type="text" class="form-control" name="titree" ng-model="registration.Adress" required>
    </div>
    <div class="form-group">
      <label id="tire75" class="col-form-label">Mobile:</label><span style="color: red">*</span>
      <input type="text" class="form-control" name="titree" ng-model="registration.Mobile" required>
    </div>
    <div class="form-group">
      <label id="site" class="col-form-label">Site:</label><span style="color: red">*</span>
      <input type="text" class="form-control" name="titre12" ng-model="registration.Site" required>
    </div>
  </form>
</div>

<button type="button" class="btn btn-primary" id="btnsave" data-dismiss="modal" onclick="JSalert()" ng-click="signUp()" style="margin-left: 350px" disabled>Done
                    </button>

【问题讨论】:

  • 因此,除了说明如果您只想更新将涉及使用 ajax 而不是 location.reload() 的页面的一部分,您的问题提到了更新表,但您的问题没有显示 sn-p 中的任何表格。
  • 对不起,是的,我只想刷新页面的一部分
  • 看来需要使用AJAX技术了!

标签: html angularjs ajax


【解决方案1】:

如果只刷新特定表格而不重新加载页面,请在注册成功后再次调用服务(针对您在表格中显示的数据)。

【讨论】:

  • 抱歉没看懂你的回答
  • 成功提交表单后,您将在表格中显示该数据,因为您正在重新加载页面,对吗?
  • 是的,当点击按钮完成(提交)页面刷新时,我只有页面的一部分
猜你喜欢
  • 1970-01-01
  • 2013-08-26
  • 2020-06-27
  • 1970-01-01
  • 2020-12-06
  • 1970-01-01
  • 2021-12-26
  • 2012-04-01
  • 2012-05-25
相关资源
最近更新 更多