0

「100 MYR」未満の値を別の国の通貨に換算しています。コンバーターは JQuery (Google API) を使用しています。下の別のページで、値 (変換された通貨) をラベル (lblAmountPaid) に渡したいと思いました。セッションと Cookie メソッドを使用しようとしましたが、動作しませんでした。空の文字列が返されます。助けてください、ありがとう。

ここに画像の説明を入力

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');
        }
    });
});
});

以下は別のページです:

ここに画像の説明を入力

4

1 に答える 1