简体   繁体   English

在Spring MVC中关闭jquery ui弹出后关闭后必须重定向HTML页面

[英]Html page must be redirect after closing jquery ui popup close after sometime in spring mvc

Html page must be redirect after closing jquery ui popup close after sometime in spring mvc 在Spring MVC中关闭jquery ui弹出后关闭后必须重定向HTML页面

hi my project based spring mvc project in scala, i have a specific need when i submit the form via submit button jquery-ui pop showed after ax time it must be close automatically then i need to redirect to next page But the problem is when i submit the form it'l redirect to next page very fast i canonot actuall see the popup script 您好我在Scala中基于项目的spring mvc项目,当我通过ax时间后显示的提交按钮jquery-ui pop提交表单时,我有一个特殊需要,它必须自动关闭,然后我需要重定向到下一页,但是问题是当我提交表单,它将很快重定向到下一页,我无法实际看到弹出脚本

$(document).ready(function(){
  $("#button").click(function(){


    $("#alert").dialog({

        modal: true,
        open: function() { var foo = $(this);
            setTimeout(function() {
               foo.dialog('close');
            }, 3000);
        }
    });

  });
});

spring controller in scala Scala中的弹簧控制器

  @RequestMapping(value = Array("/Next.html"), params = Array({ "submit" }))
  def next(model: ModelMap, @RequestParam opt: String, opt1: String, opt2: String): String = {

    processing(opt, opt1, opt2)
    println(opt + " " + opt1 + " " + opt2)
    b += 1

    "redirect:/student/test.html"
  }

my html form 我的html表格

<form action="#" th:action="@{/Next.html}">
            <div th:each=" q: ${question}">


                <input  type="submit" name="submit"
                     />
            </div>
        </form>

The problem is submit button will submit the form as soon you click on it. 问题是提交按钮将在您单击表单后立即提交。 Make the type of button as button instead of submit so that it will not submit your form on clicking. 将按钮的类型设置为按钮而不是提交,以便单击时不会提交表单。 Now bind your click function on this button like you did with a little modification suggested below. 现在,像在下面建议的一些修改一样,将单击功能绑定到此按钮上。

$(document).ready(function(){
  $("#button").click(function(){


    $("#alert").dialog({

        modal: true,
        open: function() { var foo = $(this);
            setTimeout(function() {
               foo.dialog('close');
               $('form').submit();
            }, 3000);
        }
    });

  });
});

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

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