我正在将低于“100 MYR”的值转换为不同的国家货币。转换器使用 JQuery (Google API)。我想将值(转换后的货币)传递给下面另一个页面中的标签(lblAmountPaid)。我尝试使用 session 和 cookies 方法但无法正常工作,它返回空字符串。请帮忙,谢谢。
ccGOOG.js
$(document).ready(function () {
$('#submit').click(function () {
var errormsg = "";
var amount = $('#txtAmount').val();
var from = $('#drpFrom').val();
var to = $('#drpTo').val();
$.ajax({ type: "POST",
url: "WebService.asmx/ConvertGOOG",
data: "{amount:" + amount + ",fromCurrency:'" + from + "',toCurrency:'" + to + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
beforeSend: function () {
$('#results').html("Converting...");
},
success: function (data) {
$('#results').html(amount + ' ' + from + '=' + data.d.toFixed(2) + ' ' + to);
},
error: function (jqXHR, exception) {
if (jqXHR.status === 0) {
errormsg = 'Not connect.\n Verify Network.'; ;
} else if (jqXHR.status == 404) {
errormsg = 'Requested page not found. [404]'; ;
} else if (jqXHR.status == 500) {
errormsg = 'Internal Server Error [500].'; ;
} else if (exception === 'parsererror') {
errormsg = 'Requested JSON parse failed.'; ;
} else if (exception === 'timeout') {
errormsg = 'Time out error.'; ;
} else if (exception === 'abort') {
errormsg = 'Ajax request aborted.'; ;
} else {
errormsg = 'Uncaught Error.';
}
$('#results').html(errormsg);
$('<a href="#" >Click here for more details</a>').click(function () {
alert(jqXHR.responseText);
}).appendTo('#results');
}
});
});
});
下面是另一个页面: