views:

159

answers:

1

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?

A: 

I have made it work, not sure if that is the right way or not but now it works. I've modified window opener myobject code from : //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);
}

to:

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

so success jquery ajax handler was modified to :

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

and it works now :-) ...

krul