2011-09-14 12 views
1

제 애플리케이션에서 간단한 Jquery Ajax 호출을 사용하고 있지만 작동하지 않습니다. 여기 내 코드는Jquery Ajax 호출이 Rhodes에서 작동하지 않습니다.

 try{ 
      $.ajax({ 
       type: "GET", 
       url: "http://xxxxxxx/sites/weed/chkuseremail_response.php?user_name=hhhhh&type=user&[email protected]", 
       async: false, 
       success: function(result) { 
         alert("result "+result); 
         alert("result.response "+result.response); 
         alert("result.error "+result.error); 

            var error = result.error; 
            var response = result.response; 
            if (error == null || error == "null") { 
             alert("welcome1"); 
            } 
            if (response == null || response == "null") { 
             alert("welcome2"); 
            } 

            }, 
             error: function() { 
               alert("welcome3"); 
               } 
             }); 

      }catch(e) {alert(e); 

}  

로도 3.0.2를 사용하고 있습니다.

+0

"작동하지 않음"을 정의하십시오. –

+0

여기에 결과가 result = "", result.response = null, result.error = null, 3 개의 경고가 모두 표시됩니다. welcome1, welcome2, welcome3 –

답변

0

이것은 도메인 간 정책 제한 때문에 발생합니다.

보안상의 이유로 사이트를 탐색 할 때 다른 호스트에 대한 ajax 호출이 브라우저에서 비활성화됩니다.

Rhodes 응용 프로그램에서도 똑같은 문제가 발생합니다. 응용 프로그램의 동일한 도메인에서 실행되지 않는 웹 서비스는 호출 할 수 없습니다.

JSONP을 사용하면 외부 JSON 데이터를 가져올 수 있습니다.

+0

응답 해 주셔서 감사합니다. 콜백 및 jsonp로이 문제를 해결했습니다. –

관련 문제