2011-10-05 4 views
0

나는 sencha touch에서 응답 MIME 유형을 구분하기 위해 고심하고있다. 내 로그인 서비스는 로그인 성공시 JSON 객체를 제공하는 방식으로 설계되었습니다. 인증에 실패하면 계획 오류 텍스트가 리턴됩니다. 어떻게 차이점을 찾을 수 있습니까? 내 요청은 이렇게 보입니다.Sencha에서 응답 MIME 유형을 식별하는 방법

Ext.Ajax.request({ 
       url : 'http://xxxx.com/Sencha/LoginServlet?userid='+ agentid + "&password=" + password,      
       type:'json',   
       success : function(response, opt) { 
        alert("response text" + response.responseText); 
        var obj = Ext.decode(response.responseText); 
        console.dir(obj); 
        App.views.viewport.reveal('nextScreen'); 
      }, 

      failure : function(response, opt) { 
       Ext.Msg.alert('Failed', response.responseText); 
      } 

      }); 

답변

2

Ext JS는 내부적으로 XMLHttpRequest 객체를 사용하므로 응답은 w3 컨소시엄과 호환됩니다. 따라서 일반적인 자바 스크립트에서와 같이 응답 객체 속성을 검색 할 수 있습니다. 예 : here를 참조 응답 오브젝트에서 다른 세부 정보를 검색하는 방법에 대한 자세한 내용은

response.getResponseHeader("Content-Type") 

.

관련 문제