c# - jquery ajax data result dont show -
my js file below;
$('#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 resultm = $('#detailmaxguest option:selected').val(); if (resultm != "select one") { kisi = parseint(resultm); } else { kisi = null; } 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(); 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(); } }, complete: function () { $('#reservation-result').fadeout(5000); } }); });
and controller return message;
deposit: "100 $" msg: "" success: true toplam: "1.220 $" totalsum: "1.320 $"
but cant see data on page. js working cant see datas.
my razor;
<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> <input id="btn_reservation" class="gradient-button center" type="submit" style="width: 230px;" value="rezervasyon yap" /> } <input id="btn_liste" class="gradient-button center" type="submit" style="width: 230px; display: none;" value="listeye dön" />
please helpppp :) lot.
in code see statement:
if (data.error) {
should not be:
if (!data.error) {
Comments
Post a Comment