我有一个捕获用户输入的jquery对话框(在jquery对话框中打开PLVoceInput.aspx页面),之后使用它(通过发布它们PLVoceOutput.aspx页面)来计算服务器端的一些值并在另一个对话框中显示它们。
$("#divPLVoiceInput").dialog(
{
bgiframe: true,
autoOpen: false,
draggable: true,
modal: true,
position: 'center',
width: 400,
height: 200,
title: 'Input P&L',
open: function(event, ui) {
$(this).load("PLVoceInput.aspx?customertype=ex");
},
buttons:
[
{
text: "Ok",
click: function() {
var v1=$("#tbSubsidizeVal").val();
var v2 = $("#tbSubsidizeSims").val();
var v3 = $("#tbSimCost").val();
var v4 = $("#tbOtherCostsSim").val();
var v5 = $("#tbLPs").val();
var v6 = $("#tbSalesComm").val();
var v7 = $("#tbContractLength").val();
var v8 = $("#tbPreTaxDiscountRate").val();
$("#divPLVoiceOutput").css('display', 'block');
$.ajax({
url: "PLVoceOutput.aspx",
//type: "POST",
data: {
valSubsidizeVal: v1,
valSubsidizeSims: v2,
valSimCosts: v3,
valOtherCosts: v4,
valLP: v5,
valSalesComm: v6,
valContractLength: v7,
valPreTaxDiscountRate: v8
}
});
$(this).dialog("close");
$("#divPLVoiceOutput").dialog("open");
}
},
{
text: "Cancel",
click: function() {
$(this).dialog("close");
}
}
]
});
$("#divPLVoiceOutput").dialog(
{
bgiframe: true,
autoOpen: false,
draggable: true,
modal: true,
position: 'center',
width: 600,
height: 500,
title: 'Detalii P&L',
open: function(event, ui) {
$(this).load("PLVoceOutput.aspx");
},
buttons: [
{
text: "Ok",
click: function() { $(this).dialog("close"); }
}
]
});
问题是第二个对话框打开两次aspx页面,首先传递参数,第二个没有任何参数,因此显示的数据不正确。我应该在代码中更改什么?谢谢
答案 0 :(得分:0)
我找到了解决方案:
$("#divPLVoiceInput").dialog(
{
bgiframe: true,
autoOpen: false,
draggable: true,
modal: true,
position: 'center',
width: 425,
height: 250,
title: 'Input P&L',
open: function(event, ui) {
$(this).load("PLVoceInput.aspx?customertype=ex");
},
buttons:
[
{
text: "Ok",
click: function() {
$("#divPLVoiceOutput").css('display', 'block');
var inputData = 'valSubsidizeVal=' + $("#tbSubsidizeVal").val() +
'&valSubsidizeSims=' + $("#tbSubsidizeSims").val() +
'&valSimCosts=' + $("#tbSimCost").val() +
'&valOtherCosts=' + $("#tbOtherCostsSim").val() +
'&valLP=' + $("#tbLPs").val() +
'&valSalesComm=' + $("#tbSalesComm").val() +
'&valContractLength=' + $("#tbContractLength").val() +
'&valPreTaxDiscountRate=' + $("#tbPreTaxDiscountRate").val();
$("#divPLVoiceOutput").dialog({
bgiframe: true,
autoOpen: false,
draggable: true,
modal: true,
position: 'center',
width: 600,
height: 500,
title: 'Detalii P&L',
open: function(event, ui) {
$(this).load("PLVoceOutput.aspx?" + inputData);
},
buttons: [
{
text: "Ok",
click: function() { $(this).dialog("close"); }
}
]
});
$("#divPLVoiceOutput").dialog("open");
$("#divPLVoiceInput").dialog("close");
}
},
{
text: "Cancel",
click: function() {
$(this).dialog("close");
}
}
]
});