简体   繁体   English

验证通过php ajax调用成功后如何关闭javascript弹出框

[英]How do I close javascript popup box after validation is successful with php ajax call

In my html form, a popup window appears for registration. 在我的html表单中,出现一个弹出窗口供注册。 It validates data with an ajax/query call with regProcess.php page. 它使用regProcess.php页面的ajax / query调用来验证数据。 This page is passing data to html form with json_encode . 此页面正在使用json_encode将数据传递到html表单。 Well, when all validation is successful I want to close the html popup box after few second. 好吧,当所有验证成功后,我想在几秒钟后关闭html弹出框。 How can I do this? 我怎样才能做到这一点?

<script>
  $('#form1').submit(function(event) {
    event.preventDefault();
    $.ajax({
      type: 'POST',
      url: 'backup.php',
      data: $(this).serialize(),
      dataType: 'json',       

      success: function (data) {
        $('#info1').html('');
        $.each( data, function( key, value ) {
          $('#info1').append('<p>'+value+'</p>');               
        });    

      }
    });
  });
</script>

The popup window appears with following div call. 随即出现以下div调用弹出窗口。

<div id="register">
  <a class="big-link" data-reveal-id="myModal">
    <button type="button" name="" value="" class="css3button">Join the campaign</button>
  </a>
</div>

You can put a jquery function in the success function with the setTimeout() 您可以使用setTimeout()将jquery函数放入成功函数中

http://www.w3schools.com/jsref/met_win_settimeout.asp http://www.w3schools.com/jsref/met_win_settimeout.asp

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

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