Asp.net mvc 3 模式窗口在关闭后将表单数据放置在querystring上
我有一个MVC3站点,它生成一个带有安全问题的模式窗口。问题是,当ajax调用返回时,无论是成功还是错误,并且模式窗口关闭,所有表单数据都会在父窗口的查询字符串上结束Asp.net mvc 3 模式窗口在关闭后将表单数据放置在querystring上,asp.net-mvc-3,jquery,Asp.net Mvc 3,Jquery,我有一个MVC3站点,它生成一个带有安全问题的模式窗口。问题是,当ajax调用返回时,无论是成功还是错误,并且模式窗口关闭,所有表单数据都会在父窗口的查询字符串上结束 $(this).dialog('destroy'); 和 $(this).dialog('destroy').remove(); and placing close: function () { $(this).dialog('destroy'); }, 和 $(this).dialog('destroy').remov
$(this).dialog('destroy');
和
$(this).dialog('destroy').remove();
and placing close: function () { $(this).dialog('destroy'); },
和
$(this).dialog('destroy').remove();
and placing close: function () { $(this).dialog('destroy'); },
在对话框中实例化,成功率为零
如何防止模式窗口将表单值传递给父窗口查询字符串
出现在模态窗口中的局部视图
<div id="resetpanel">
<form name="pwreset" id="pwreset" action="" method="post">
Account Number: <input type="text" name="acctNumber" id="acctNumber" /><br />
<button class="btn" name="btnNext" onclick="goResetValidate();return false;">Next</button>
</form>
</div>
<div id="challengepanel">
<form name="challenge" id="challenge" style="display:none;" action="" method="post">
<input type="hidden" name="setNum" id="setNum" value="" />
Member Number: <input type="text" name="acctNumber2" id="acctNumber2" readonly="true" /><br />
<label id="Q0"></label>
Answer: <input type="text" name="answer1" id="answer1" /><br />
<label id="Q1"></label>
Answer: <input type="text" name="answer2" id="answer2" /><br />
<label id="Q2"></label>
Answer: <input type="text" name="answer3" id="answer3" /><br />
<button class="btn" name="btnNext" id="challengebutton" onclick="goResetPassword();return false;">Submit</button>
</form>
</div>
//捕获帐号/qeustins集合号/答案并将其发送到服务进行处理的函数函数goResetPassword(){ 模态窗口Jquery
//function that captures the account number and sends them to the service for processing
function goResetValidate() {
// check that all answers are numbers only on challenge questions
var ruleset = {
required: true,
digits: true
};
$('#pwreset').validate({
rules: {
qSet0: ruleset,
qSet1: ruleset,
qSet2: ruleset
}
});
// challenge questions for password reset
var qSet0 = ["Please enter the numeral of the month you were born (i.e. January = 1, February = 2)", "Please enter the last 4 digits of your Social Security number (i.e. 444-55-XXXX)", "Please enter your home zip code - first five digits only (i.e. 22333)."];
var qSet1 = ["Please enter the day of the month you were born (i.e. 1, 2, 3, etc.).", "Please enter the 2 middle digits of your Social Security number (i.e. 444-XX-6666).", "Please enter the last 4 digits of your home telephone number (i.e. 703-555-XXXX)."];
var qSet2 = ["Please enter the first 3 digits of your Social Security number (i.e. XXX-55-6666).", "Please enter the 3 middle digits of your home telephone (i.e. 703-XXX-5555).", "Please enter your home zip code - first five digits only (i.e. 22333)."];
// rand for choice of questions
var random = (Math.ceil(Math.random() * 3) - 1);
var jRequest = {};
var acnum = $("#acctNumber").val();
jRequest.an = acnum;
var jData = {};
jData.request = jRequest;
$.ajax({
cache: false,
type: "POST",
async: false,
url: ResetValidateUrl,
data: JSON.stringify(jData),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (splashObj) {
switch (splashObj.ResetValidateResult.RESPONSE) {
case "VALID":
var challengequestiondisplayed = splashObj.ResetValidateResult.RESPONSE;
var quest = "qSet" + random;
// remove reset form
$('#resetpanel').fadeOut("slow", function () {
$('#resetpanel').remove();
$('#acctNumber2').val(acnum);
$('#setNum').val(random);
});
$.each(eval(quest), function (index, item) {
$('#Q' + index).text("" + this + "");
});
$('form#challenge').fadeToggle("slow", "linear");
break;
// bad member number
case "INVALID":
alert("We're sorry; the system did not recognize the Member Number entered. Please try again.");
break;
// no email on file
case "NO_EMAIL":
alert("This feature requires a valid email in the system. Please contact us to provide a valid email address.");
break;
// error
case "ERROR":
alert("We're sorry; the system was uanble to complete your request. We apologize for the inconvenience.");
break;
// system is in memo-post mode
case "MEMO_POST":
alert("The system is unavailable at this time. Please try your request again later.");
break;
}
},
error: function (xhr) {
alert("A Password Web Service Error!");
//$(this).dialog('destroy').remove();
}
});
}
$(document).ready(function () {
$(".openDialog").live("click", function (e) {
e.preventDefault();
$("<div></div>")
.addClass("dialog")
.attr("id", $(this).attr("data-dialog-id"))
.appendTo("body")
.dialog({
title: $(this).attr("data-dialog-title"),
close: function () { $(this).dialog('destroy'); },
modal: true,
width: '530px'
})
.load(this.href);
});
$(".close").live("click", function (e) {
e.preventDefault();
$(this).closest(".dialog").dialog("close");
});
});
$(文档).ready(函数(){
$(“.openDialog”).live(“单击”,函数(e){
e、 预防默认值();
$("")
.addClass(“对话框”)
.attr(“id”,$(此).attr(“数据对话框id”))
.附件(“正文”)
.对话({
标题:$(this.attr(“数据对话框标题”),
关闭:函数(){$(this).dialog('destroy');},
莫代尔:是的,
宽度:“530px”
})
.load(this.href);
});
$(“.close”).live(“单击”),函数(e){
e、 预防默认值();
$(此).close(.dialog”).dialog(“关闭”);
});
});
听着,我不明白你的问题,但我会尽力解决你的问题
$("#my-form-div").dialog({
autoOpen: true,
width: 600,
height: 600,
modal: true,
draggable:true,
resizable:false,
title: 'FORM',
buttons: [
{
text: "CLOSE",
className: 'close-button-class',
click: function() {
// do what ever you want on the close event
$(this).dialog("close");
location.reload();
}
}
],
open: function() {
//do whatever you want on the open event.
$("#my-form-div").html("<%= escape_javascript(render('form_view')) %>");
}
});
$(“#我的表单div”)。对话框({
自动打开:对,
宽度:600,
身高:600,
莫代尔:是的,
真的,
可调整大小:false,
标题:“表格”,
按钮:[
{
文本:“关闭”,
className:“关闭按钮类”,
单击:函数(){
//在闭幕式上你想做什么
$(此).dialog(“关闭”);
location.reload();
}
}
],
打开:函数(){
//在公开赛上你想做什么就做什么。
$(“#我的表单div”).html(“”);
}
});
请更清楚地说明您想要什么。啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊获取用户号的nput字段。在该模式窗口中单击一个按钮可使用Ajax调用检查数据库中的该号码。如果失败,我将发出警报,然后关闭模式窗口。模式窗口正在将号码和按钮名称发送到查询字符串中的父级。我希望防止数据基于父级地址ess。尝试弄乱按钮元素的类型属性(button,submit)。从内存中看,如果不指定类型,表单中的按钮元素在某些浏览器中可能会出现异常行为。如果这可以解决问题,我将重新发布作为答案。