2015-07-03 59 views
0

下午好,我在javascript调用中遇到数据无法提供的问题。Ajax Handler回调函数:响应对象未定义

案例1:

function FirstFunction() { 
      $.ajax({ 
      url: "abc.axd", 
      cache: false, 
      dataType: "json", 
      success: function (resp) { 
       SecondFunction(resp); 
      }, 
      error: function() { alert("Error Occured") } 
     }); 
    } 

    function SecondFunction(data) { 
     alert("SecondFunction"); 
     alert(data.responseText); 

    } 

它triggeres第二功能,但alert(data.responseText)总是undefined

案例2:

async: false尝试过。

但仍然但alert(data.responseText)未定义。

案例3:

我已经试过这一个,以及但是还是同样的问题, jQuery Ajax results in undefined

有人能指出我缺少了什么吗?

+0

就是我的回答工作? –

+1

只是建立的应用程序..让你知道在一分钟 –

+0

热切地等待......':D' –

回答

1

试试这个方法:

data = JSON.parse(data); 
alert(data.IsPackageStillAvailableForSamePrice); 
相关问题