예 :

2010-03-29 8 views
1

두 오류를 일으키는 IE에 문제가 있습니다.
개체가이 속성 또는 메서드
을 지원하지 않습니다. 2. 호출 수신자가 호출을 거부했습니다.예 :

의도 : 는 Ajax를 사용하여 일부 데이터를 검색하고 응답을 처리 할 예정이다 통화를 시작한 팝업 창에서 중첩 된 기능을 살고 콜백 함수 에 전달하는 것입니다 window.opener.myObject 메서드를 호출 데이터를 수정하고 그에 따라 팝업 창을 수정하십시오.

시나리오 : 일부 특정 작업을 처리하는 팝업 창이 나타납니다. ajax 호출을 사용하는 window.opener.myObject 메소드를 호출하는이 팝업 창. 응답을 처리 할 팝업 창 함수를 전달 중이며 ff와 safari에서는 작동하지만 ie와는 작동하지 않습니다. 다음은 코드 샘플입니다.

//RELEVANT SCRIPT ON POPUP WINDOW 
$('#myButton').live('click', function() { 
    var h = window.opener.myObject, p = { 'p1': 1 }; 
    var responseHandler = function(responseObj) { 
     //in IE we never got here 
     if (!responseObj) { 
      alert('Unexpected error!! No response from server'); 
      return false; 
     } 
     //..handle response 

    }; 
     p.p1 = $('#control').val(); 
     h.executeMethod(p, responseHandler); 
}); 

//RELEVANT SCRIPT ON WINDOW OPENER MYOBJECT 
try { 
$.ajax({ 
    type: 'POST', 
    async: true, 
    url: url, 
    data: postData, 
    dataType: "json", 
    contentType: 'application/x-www-form-urlencoded; charset=utf-8', 
    success: r, // r here is reference to my responseHandler popup window function 
    error: handleError 
}); 
} catch (ex) { 
alert(ex.message); 
} 

팁이 있습니까?

답변

1

나는 그것이 올바른 방법인지 아닌지는 확실하지 않지만 지금은 효과가있다. 내가로부터 윈도우 오프너 즉, myObject 코드를 수정했습니다 : 창 오프너 MyObject를

try { 
$.ajax({ 
    type: 'POST', 
    async: true, 
    url: url, 
    data: postData, 
    dataType: "json", 
    contentType: 'application/x-www-form-urlencoded; charset=utf-8', 
    success: r, // r here is reference to my responseHandler popup window function** 
    error: handleError 
}); 
} catch (ex) { 
alert(ex.message); 
} 

에 가 //되는 관련 SCRIPT :

success: function(myResponseObj) { 
    r.call(null, myResponseObj); 
} 
:

//RELEVANT SCRIPT ON WINDOW OPENER MYOBJECT 
try { 
$.ajax({ 
    type: 'POST', 
    async: true, 
    url: url, 
    data: postData, 
    dataType: "json", 
    contentType: 'application/x-www-form-urlencoded; charset=utf-8', 
    success: function(myResponseObj) { 
     r.call(null, myResponseObj); 
    } 
    error: handleError 
}); 
} catch (ex) { 
alert(ex.message); 
} 

그래서 성공 JQuery와 아약스 처리기로 수정

이제 작동합니다 .-