views:

24

answers:

1

Hi there,

I have a static web method which returns an object and this object has some values. I am calling this function from an ajax call.

 $.ajax({
           url: "EuclidAktarim.aspx/f_EuclideGonder_",
           type: "POST",
           data: "{_sTCKimlikNo:'" + tc + "', _iKlinik_id:" + iKlinikId + ", _iYil:" +  iYil + ", _byAy:" + seciliAy + ", _iUid:" + iUid + ", _bHepsi:" + $(cbHepsi).attr("checked") + ", _sServisAdresi:'" + sEuclidServisAdres + "', _enumKanTahlilikontrolTarih:'" + sCalismaKayitTarihi + "', _enumHastaKontrolKodu:'" + sHastaKontrolKodu + "', _bSimuleEt:" + simuleEt + "}",
           contentType: "application/json; charset=utf-8",
           beforeSend: function(xhr) {
                   $(spn).html("<img src='Img/loadingSatir.gif' alt='Gönderiliyor'/>");
                  },
           success: function(msg) {
                  var sonuc = "";
                  sonuc = msg.hasOwnProperty('d') ? msg.d : msg;
                  $(spn).html("<img src='Img/green-check.gif' alt='" + sonuc + "'/>");
              },
           error: function(hata) {
                 var sonuc = "";
                 sonuc = hata.hasOwnProperty('d') ? hata.d : msg;
                 $(spn).html("<img src='Img/error.gif' alt='" + sonuc + "'/>");
          },
          complete: function(eee) {
                 if ($(spn).html() == "<img src='Img/loadingSatir.gif' alt='Gönderiliyor'/>") 
                 {
                   $(spn).html("Göndermek için tekrar tıklayınız.")
                 }
           }
         });

I can see this result while looking to a watch for "msg:d" in success part.

alt text

I want to read M_Durum object but it says msg.d.M_Durum is undefined object. Where is the problem i dont understand.

Thanks for your helps.

KR,

+2  A: 

Try specifying the dataType:

...
type: 'POST',
dataType: 'json',
...
Darin Dimitrov

related questions