当jquery ajax再次发布清晰数据时

时间:2013-05-21 11:52:50

标签: c# asp.net-mvc jquery

我有2个脚本用于分开计划。

 var kisi;
$('#DetailDatepickerEnd').datepicker({
    dateFormat: 'dd MM yy',
    defaultDate: "+1w",
    changeMonth: true,
    onSelect: function (selectedDate) {
        var dt = $("#DetailDatepickerEnd").val();
        $("#LoadingImage").show();
        var resultid = $('#resultid').val();
        var dateBegin = $('#DetailDatepicker').val();
        var price=$('#DetailRates option:first').val();
        var result = $('#DetailMaxGuest option:selected').val();
        if (result != "Select One") {
            kisi= parseInt(result);
        } else {
            kisi = null;
        }
        $.ajax({
            url: '/Product/GetReservation',
            type: 'GET',
            data: { 'lastDate': dt,'kisi':kisi,'resultid':resultid,'dateBegin':dateBegin,'price':price },
            contentType: 'application/json; charset=utf-8',
            dataType: 'json',
            success: function(data) {
                if (data.error) {
                    $("#LoadingImage").hide();
                    $('#reservation-result').empty();
                    $('#reservation-result').html(data.msg).fadeIn(2000);
                    $('#btn_reservation').hide();
                    $('#btn_liste').show();
                } if(data.success) {
                    $("#LoadingImage").hide();
                    $('#reservation-result').empty();
                    $('#reservation-result').show();
                    if (kisi != null) {
                        $('#PriceDetails').show();
                    } else {
                        $('#PriceDetails').hide();
                    }
                    $('#lblTotalPrice').html(data.toplam).fadeIn(2000);
                    $('#lblDeposit').html(data.deposit).fadeIn(2000);
                    $('#lblTotal').html(data.totalsum).fadeIn(2000);
                    $('#btn_reservation').show();
                    $('#btn_liste').hide();


                }
            },
        });

    }

});
$('#DetailMaxGuest').change(function () {

    var result = $('#DetailMaxGuest option:selected').val();
    $('#DetailMaxGuest option:selected').val(result).attr('selected', 'selected');
    var resultparse = parseInt(result);
    var resultid = $('#resultid').val();
    var dateBegin = $('#DetailDatepicker').val();
    var dateEnd=$('#DetailDatepickerEnd').val();
    var price=$('#DetailRates option:first').val();

    var message = {
        'resultid':resultid, 
        'data':resultparse,
        'dateBegin':dateBegin,
        'dateEnd':dateEnd,
        'price':price
    };
    $("#LoadingImage").show();
    $.ajax({

        type: 'GET',
        url: '/Product/GetMaxGuest',
        data: message,
        dataType: 'json',
        success: function (data) {
            if (data.error) {

                $("#LoadingImage").hide();
                $('#reservation-result').html(data.msg).fadeIn(2000);
                $('#btn_reservation').hide();
                $('#btn_liste').show();
            } if(data.success) {
                $("#LoadingImage").hide();
                $('#reservation-result').html(data.msg).fadeIn(1000);
                $('#PriceDetails').show();
                $('#lblTotalPrice').html(data.toplam).fadeIn(2000);
                $('#lblDeposit').html(data.deposit).fadeIn(2000);
                $('#lblTotal').html(data.totalsum).fadeIn(2000);
                $('#btn_reservation').show();
                $('#btn_liste').hide();

            }
        }

    });

});

DetailDatePicekerEnd没问题。检查预订并返回结果。但是当点击DetailMaxGuest时,我的页面上看不到结果....我的页面下面是html代码;

<div id="reservation-result" style="width: 100%; height: 80px; display: inline-block; text-align: left; font-size:12px; font-weight: bold; color:brown;">
                                <table id="PriceDetails" style="display: none;">
                                    <tr>
                                        <td style="width: 75%;">Toplam Fiyat</td>
                                        <td style="width: 25%; text-align: right;"><div id="TotalPrice">@Html.Label("lblTotalPrice",new{id="lblTotalPrice", name="TotalPrice"})</div></td>

                                    </tr>
                                    <tr>
                                        <td>Depozito</td>
                                        <td style="width: 25%; text-align: right;">
                                            <div id="Deposit">@Html.Label("Deposit",new{id="lblDeposit", name="Deposit"})</div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>Genel Toplam</td>
                                        <td style="width: 25%; text-align: right;">
                                            <div id="Total">@Html.Label("Total",new{id="lblTotal", name="GrandTotal"})</div>
                                        </td>
                                    </tr>
                                </table>
                                <div id="LoadingImage" style="display: none;">
                                    <img src="@Url.Content("~/Content/images/prettyPhoto/dark_rounded/loader.gif")" alt="Loading"/>
                                </div>
                            </div>

如何显示我的结果????非常感谢。

0 个答案:

没有答案