The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Problems with ajax request from a window

I have a problem trying to call a method in the parent window from a popup.

The problem isn't that the parent method cannot be called, but the method is either not managing to find an attribute or the ajax request it is executing is not being dealt with correctly.

The situation -

I have an object called "Event" with a method called "updateSessionDate", which runs as it should. The method uses an ajax object to execute an ajax request.

A date input field has an onchange event so that it calls the updateSessionDate method when the field is updated.

There is also an option to open up a popup with a calendar, which lists a bunch of dates, and when clicked updates the date input field.

When the date field is changed in this fashion the onchange event is not triggered. This could cause a few problems, so i have been attempting to call the updateSessionDate method from the popup window when a date is clicked.

The following code is called when a date is clicked in the calendar popup:

Code JavaScript:

opener.objEvent.updateSessionDate(id);

Now i'd expected this to work, but it does not return any data from the ajax request.

The request is still executed and the query string is sent (tried alerting the string, and it works fine), and the requestChange method is called, but no response is returned UNLESS i add the alert after the this.objRequest.send () call in the ajax post method, and everything works fine!!!

Yes updateSessionDate works correctly on the parent page, just not when called from the popup.

objEvent is an object that contains the updateSessionDate method. It also contains other methods to deal with other event details as, apposed to an event session, and attrbitures such as the event ID and the ajax object, which are set in the object constructor.

Yes the updateSessionDate and the ajax methods, and ajax return method are all being called. The problem seems to be that unless i put something like an alert after the post in the ajax post method nothing is returned.

The javascript:window.opener.objEvent.updateSessionDate('test'); in the address bar works.