0
我将“100 MYR”以下的值转换为不同的国家/地区货币。转换器使用JQuery(Google API)。我想在下面的另一个页面中将值(转换币种)传递给标签(lblAmountPaid)。我尝试使用会话和cookie方法,但无法工作,它返回空字符串。请帮忙,谢谢。从JQuery向ASP.NET提取值
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');
}
});
});
});
下面是另一个页面:
谢谢你的回复。我关注了一切,当我点击转换按钮时,它显示一个消息框显示“失败”,并且没有任何值返回到其他页面。我不明白为什么。 – Roshan