如何创建不带页面重新加载的多重提交表单? [英] How Do I Create a multi submit form with no page reload?

查看:54
本文介绍了如何创建不带页面重新加载的多重提交表单?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个有多个问题的表单,他们可以点击下一个问题,但不会加载页面。

例如,
$ b

例如



http: //www.garmin.com/us/intheair/ads-b/#scroll-to-installation-planner



点击开始



页面无法重新加载,每选择一个广播选项并单击下一页,也不会加载新页面......我该如何做这样的事情?

解决方案

点击下一步,不要重新加载页面。



变量在JavaScript变量中,例如:



  var结果点击(function(){
results.push($(select1)。val());
//(#next-button)。将其他结果推送到结果数组
})

然后在结束时,你可以ajax调用以提交结果:

$ $ p $ $ $ $ $ ajax({
type:POST,$ b $ (url):some.php,
data:results
))
.done(function(msg){
alert(Data Saved:+ msg);
});

让我知道您是否需要更多帮助

< (这种方法是由jQuery促进)


I want to create a form that has multiple questions, upon each question they can click next, but the page does not load

For example

http://www.garmin.com/us/intheair/ads-b/#scroll-to-installation-planner

Click Begin

The page does not reload, and with each radio option selected and clicking next, also does not load a new page... how do I do something like this?

解决方案

After clicking next, don't reload the page.

Instead store all the selected variables in a javascript variable,

for example:

var results = []l
$("#next-button").click(function() {
    results.push($("select1").val());
    // push other results to results array
})

then at the end, you can make an ajax call to submit results:

$.ajax({
    type: "POST",
    url: "some.php",
    data: results
})
.done(function( msg ) {
    alert( "Data Saved: " + msg );
});

Let me know if you need more help

(this method is facilitated by jquery)

这篇关于如何创建不带页面重新加载的多重提交表单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆