passing callback function accross windows causing error with ie ...

Posted by krul on Stack Overflow See other posts from Stack Overflow or by krul
Published on 2010-03-29T01:09:08Z Indexed on 2010/03/29 1:13 UTC
Read the original article Hit count: 339

I have a problem with IE causing two errors:
1. Object doesn't support this property or method
2. Call was rejected by callee.

My Intention: To call window.opener.myObject method that is going to retrieve some data using ajax and pass in callback function that live as nested function in popup window that initiated call that is going to handle response data and modify popup window html accordingly.

Here is a scenario: I pull up popup window that handles some specific operation. This popup window calling window.opener.myObject method that using ajax call. I'm passing in popup window function that is going to handle response and it works with ff and safari but not with ie. Here is code sample

 //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);
}

Any tips?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery